<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.oiue</groupId>
		<artifactId>oiue</artifactId>
		<version>1.0.0</version>
	</parent>
	<groupId>org.oiue.services</groupId>
	<artifactId>imports</artifactId>
	<version>1.0.0</version>
	
	<url>http://maven.oiue.org</url>
	<packaging>pom</packaging>
	<dependencies>
		<dependency>
			<groupId>org.oiue</groupId>
			<artifactId>tools</artifactId>
			<version>1.0.0</version>
		</dependency>
		<dependency>
			<groupId>org.oiue.services</groupId>
			<artifactId>org.oiue.service.osgi.rpc</artifactId>
			<version>1.0.0</version>
		</dependency>
		<dependency>
			<groupId>org.oiue.services</groupId>
			<artifactId>org.oiue.service.log</artifactId>
			<version>1.0.0</version>
		</dependency>
		<dependency>
			<groupId>org.oiue.services</groupId>
			<artifactId>org.oiue.service.system.analyzer</artifactId>
			<version>1.0.0</version>
		</dependency>
		<dependency>
			<groupId>ant-contrib</groupId>
			<artifactId>ant-contrib</artifactId>
			<version>1.0b3</version>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.12</version>
			<scope>test</scope>
		</dependency>
	</dependencies>
	<dependencyManagement>
		<dependencies>
		</dependencies>
	</dependencyManagement>

	<distributionManagement>
		<!-- <repository> <id>releases</id> <url>http://10.182.192.212:8081/nexus/content/repositories/releases</url> </repository> <snapshotRepository> <id>snapshots</id> <url>http://10.182.192.212:8081/nexus/content/repositories/snapshots</url> </snapshotRepository> -->
	</distributionManagement>
	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	</properties>
	<build>
		<plugins>
			<!-- 把依赖的jar包拷到lib目录下 -->
			<!-- 
<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<executions>
					<execution>
						<id>copy-dependencies</id>
						<phase>initialize</phase>
						<goals>
							<goal>copy-dependencies</goal>
						</goals>
						<configuration>
							<outputDirectory>${project.build.directory}/lib</outputDirectory>
							<overWriteReleases>false</overWriteReleases>
							<overWriteSnapshots>false</overWriteSnapshots>
							<overWriteIfNewer>true</overWriteIfNewer>
						</configuration>
					</execution>
				</executions>
			</plugin>
 -->
			<!-- 打包bundle文件为bundle.jar文件 -->
			<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
				<extensions>true</extensions>
				<configuration>
					<instructions>
						<X-bundle-Version>${project.version}</X-bundle-Version>
						<Bundle-Activator>${project.activator}</Bundle-Activator>
						<Bundle-Name>${project.name}</Bundle-Name>
						<Bundle-ManifestVersion>2</Bundle-ManifestVersion>
						<Bundle-Description>${project.description}</Bundle-Description>
						<Bundle-Vendor></Bundle-Vendor>
						<Embed-Transitive>true</Embed-Transitive>
						<Embed-Dependency>${project.dependency};scope=compile|runtime</Embed-Dependency>
						<Import-Package>${project.import}</Import-Package>
						<Export-Package>${project.export}</Export-Package>
						<Embed-Directory>lib</Embed-Directory>
						<Embed-StripGroup>true</Embed-StripGroup>
					</instructions>
				</configuration>
			</plugin>
			<!-- 打包source文件为jar文件 -->
			<plugin>
				<artifactId>maven-source-plugin</artifactId>
				<version>2.1</version>
				<configuration>
					<attach>true</attach>
					<encoding>UTF-8</encoding>
				</configuration>
				<executions>
					<execution>
						<phase>compile</phase>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
			<!-- 将打包的bundle文件拷贝到项目的bundle目录 -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-antrun-plugin</artifactId>
				<executions>
					<execution>
						<id>copy-lib-bundle</id>
						<phase>package</phase>
						<goals>
							<goal>run</goal>
						</goals>
						<configuration>
							<tasks>
								<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="maven.runtime.classpath" />
								<if>
									<contains string="${project.packaging}" substring="bundle" />
									<then>
										<copy todir="${project.build.exportdir}">
											<fileset dir="${project.basedir}/target">
												<include name="*.?.jar" />
											</fileset>
										</copy>
									</then>
								</if>
							</tasks>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
</project>
