Maven: Maven Assembly Plugin configuration with multiple modules in a maven project
2015-05-31 16:06
399 查看
In the parent pom.xml, add the configuration
parent pom.xml<?xml version="1.0" encoding="UTF-8"?> <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>org.test</groupId> <artifactId>parent</artifactId> <version>1.0</version> <packaging>pom</packaging> <name>Parent</name> <modules> <module>child1</module> <module>child2</module> <module>child3</module> </modules> <build> <finalName>final-package-name</finalName> <plugins> <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>2.4</version> <configuration> <descriptors> <descriptor>assembly.xml</descriptor> </descriptors> <appendAssemblyId>false</appendAssemblyId> </configuration> </plugin> </plugins> </build> </project>
This POM simply directs the Assembly Plugin to use the assembly.xml assembly descriptor when executing.
Know more about Maven Assembly Plugin: http://maven.apache.org/plugins/maven-assembly-plugin/
The assembly.xml configuration content
assembly.xml<assembly> <id>workflow</id> <formats> <format>zip</format> <!--The type of package which you want--> </formats> <fileSets> <fileSet> <directory>config</directory> </fileSet> </fileSets> <!-- <includeBaseDirectory>false</includeBaseDirectory> --> <moduleSets> <moduleSet> <includes> <include>org.test:child1</include> </includes> <sources> <includeModuleDirectory>false</includeModuleDirectory> <fileSets> <fileSet> <directory>target</directory> <outputDirectory>../lib</outputDirectory> <includes> <include>*.jar</include> </includes> </fileSet> </fileSets> </sources> </moduleSet> <moduleSet> <includes> <include>org.test:child2</include> </includes> <sources> <fileSets> <fileSet> <outputDirectory>main</outputDirectory> <directory>main</directory> </fileSet> <fileSet> <directory>target c128 </directory> <outputDirectory>../lib</outputDirectory> <includes> <include>*.jar</include> </includes> </fileSet> </fileSets> </sources> </moduleSet> </moduleSets> </assembly>
Konw more about the Assembly Descriptor Format: http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html
In order to generate your package, just run
1) mvn clean 2) assembly:assembly
相关文章推荐
- 制作高质量的JQuery Plugin 插件的方法
- MySql报错Table mysql.plugin doesn’t exist的解决方法
- jQuery多媒体插件jQuery Media Plugin使用详解
- Ext4.2的Ext.grid.plugin.RowExpander无法触发事件解决办法
- 使用maven+eclipse搭建struts2开发环境
- maven中下载jar包源码和javadoc的命令介绍
- Maven学习笔记
- Maven for Eclipse
- maven 使用 问题记录
- 《Maven权威指南》学习笔记四_创建一个简单的Maven项目
- 《Maven权威指南》学习笔记十五_装配(Assembly Plugin) 4000
- 《Maven权威指南》学习笔记十七_一个多模块项目 3ff0
- 《Maven权威指南》学习笔记十八_多模块企业级项目 3ff0
- 《Maven权威指南》学习笔记二十_关于POM
- eclipse 安装插件的方法
- 近日maven学习概况
- Eclipse Maven Tomcat的利用配置
- (转)Vaadin 使用 Maven
- Maven和Eclipse联合开发