assembly

打包插件

监控服务示例

外部挂在形式
	mvn clean package
	cd targer 
	mv  xxx.jar tar.xxx
	
	# 将jar 打包 加入本地仓库
	mvn install:install-file -DgroupId=com.osvue -DartifactId=server-monitor -Dversion=2.0 -Dpackaging=jar -Dfile=xxx.jar  
项目中 使用
<dependency>
	<groupId>com.osvue</groupId>
	<artifactId>server-monitor</artifactId>
	<version>2.0</version>
</dependency>


<project xmlns="http://maven.apache.org/POM/4.0.0"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">



	<modelVersion>4.0.0</modelVersion>
	<groupId>com.osvue.system</groupId>
	<artifactId>monitor</artifactId>
	<version>v-2.0</version>
	<name>monitor</name>




	<packaging>jar</packaging>


	<description>  monitor 服务  </description>
	<properties>

		<java.version>1.8</java.version>
		<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<oshi.version>5.8.0</oshi.version>
		<jna.version>5.8.0</jna.version>
		<commons.io.version>2.11.0</commons.io.version>

	</properties>
	<dependencies>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>servlet-api</artifactId>
			<version>2.5</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>com.github.oshi</groupId>
			<artifactId>oshi-core</artifactId>
			<version>${oshi.version}</version>
		</dependency>

<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-lang3</artifactId>
    <version>3.12.0</version>
</dependency>

		<dependency>
			<groupId>net.java.dev.jna</groupId>
			<artifactId>jna</artifactId>
			<version>${jna.version}</version>
		</dependency>

		<dependency>
			<groupId>net.java.dev.jna</groupId>
			<artifactId>jna-platform</artifactId>
			<version>${jna.version}</version>
		</dependency>


	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.1</version>
				<configuration>
					<source>${java.version}</source>
					<target>${java.version}</target>
					<encoding>${project.build.sourceEncoding}</encoding>
				</configuration>
			</plugin>
			
		 
            <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-assembly-plugin</artifactId>
                 <executions>
                     <execution>
                          <id>make-assembly</id>
                          <!-- 绑定到package生命周期  -->
                          <phase>package</phase>
                          <goals>
                              <!-- 只运行一次 -->
                              <goal>single</goal>
                          </goals>
                     </execution>
                 </executions>
                 <configuration>
                     <!-- 配置描述符文件  <descriptor>src/main/assembly/assembly.xml</descriptor>
                          也可以使用Maven预配置的描述符 -->
                     <descriptorRefs>
                          <descriptorRef>jar-with-dependencies</descriptorRef>
                     </descriptorRefs>
                 </configuration>
             </plugin>
    
    
		</plugins>
		
	</build>
</project>