`

maven-assembly-plugin使用介绍

阅读更多
1.引用插件
<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-assembly-plugin</artifactId>
	<version>2.2</version>
	<configuration>
		<descriptors>
			<descriptor>assembly.xml</descriptor>
		</descriptors>
	</configuration>
</plugin>

2.assembly.xml描述文件说明
from:http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
  <!-- 无实际意义,定义一个名称而已  -->
  <id>tgz</id>
  <!-- 打包的格式 -->
  <formats>
    <format>tar.gz</format>
  </formats>
  <!-- 打包文件的名称 -->
  <baseDirectory>target</baseDirectory>
  <!-- 输出的结果文件集合 -->
  <fileSets>
    <fileSet>
      <!-- 要打包的源目录 -->
      <directory>../war/target/ebbp-war-1.0-SNAPSHOT</directory>
      <!-- 输出的目录名称 -->
      <outputDirectory>ebbp.war</outputDirectory>
      <!-- 正则表达 -->
      <includes>
        <include>**</include>
      </includes>
    </fileSet>    
    <fileSet>
      <outputDirectory>deploy</outputDirectory>
      <includes>
        <include>**</include>
      </includes>
       <!-- 在满足上面正则的文件集合里面,去除一下文件或目录 -->
      <excludes>
        <exclude>assembly.xml</exclude>
	<exclude>deploy.sh</exclude>
        <exclude>shutdown.sh</exclude>
	<exclude>version.txt</exclude>
	<exclude>**/libmcpack-jni.so</exclude>
      </excludes>
      <!-- Use Unix-style line endings -->
      <lineEnding>unix</lineEnding>
    </fileSet>
    <fileSet>
      <directory>../webroot</directory>
      <outputDirectory>webroot</outputDirectory>
      <includes>
        <include>**</include>
      </includes>
      <lineEnding>unix</lineEnding>
    </fileSet>
  </fileSets>
  <!-- 要打包的文件描述 -->
  <files>
    <file>
      <source>./deploy.sh</source>
      <lineEnding>unix</lineEnding>
    </file>
    <file>
      <source>./shutdown.sh</source>
      <lineEnding>unix</lineEnding>
    </file>
    <file>
      <source>./version.txt</source>
      <lineEnding>unix</lineEnding>
    </file>
    <file>
  	<source>./tomcat/lib/libmcpack-jni.so</source>
        <outputDirectory>deploy/tomcat/lib</outputDirectory>
    </file>
  </files>  
</assembly>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics