maven配置文件assembly

来源:互联网 发布:西瓜影音mac版下载 编辑:程序博客网 时间:2024/05/21 10:57

(1)、在pom.xml 文件里面的配置说明

Java代码  

<plugin>  

    <artifactId>maven-assembly-plugin</artifactId>  

    <executions>  <!--执行器 mvn assembly:assembly-->  

        <execution>  

            <id>make-zip</id><!--名字任意 -->    

        <phase>package</phase><!-- 绑定到package生命周期阶段上 -->    

        <goals>    

           <goal>single</goal><!-- 只运行一次 -->    

        </goals>    

            <configuration>  

                     <descriptors> <!--描述文件路径-->  

                          <descriptor>src/main/resources/zip.xml</descriptor>  

                    </descriptors>  

            </configuration>  

        </execution>  

    </executions>  

 </plugin> 

 

 

<formats>
        <format>tar.gz</format>
    </formats>

    <fileSets>

     <fileSet>           

         <directory>src/main/config</directory>  //需要打包的路径           

        <outputDirectory>\</outputDirectory>   //打包后输出的路径

 

下面代码表示归档时包括some/path,不包括some/path1          

 <includes>               

<include>some/path</include>          

 </includes>           

<excludes>              

 <exclude>some/path1</exclude>          

 </excludes>       

</fileSet>


    </fileSets>

    <dependencySets>
        <dependencySet>
            <useProjectArtifact>true</useProjectArtifact>
            <outputDirectory>lib</outputDirectory>

·   <!-- 过滤 -->  

·              <excludes>  

·                  <exclude>*.xml</exclude>  

·              </excludes> 


            <!-- 将scope为runtime的依赖包打包到lib目录下。 -->
            <scope>runtime</scope>
        </dependencySet>
    </dependencySets>
</assembly>

 

format设置包输出的格式,目前还支持zip,tar,tar.gz,tar.bz2,jar,dir,war格式

fileSet定义代码目录中与输出目录的映射

directory和outputDirectory将src/main/config目录下的文件打包到根目录(/)下

dependencySets节点下为依赖设置

0 0
原创粉丝点击