有几个应用程序需要从许多模块构建和打包。
在parent pom中,我使用配置文件来调用不同应用程序的构建。
root
parent/
pom.xml
moduleA/
pom.xml
moduleB/
pom.xml
moduleC/
pom.xml例如,应用程序"profile-1“需要构建现有模块的子集,并将其放在一起作为tar ball。tar将包含几个jars和从子模块的target/中拉出的不同配置文件。
我使用通过exec-maven-plugin调用的shell脚本来组合tar。
我面临的问题是,在一个应用程序中,我需要使用不同的maven参数多次构建相同的模块。
做这件事最好的方法是什么?
<profiles>
<profile>
<id>profile-1</id>
<modules>
<module>../moduleA</module>
<module>../moduleB</module>
<!-- <module>../moduleC</module> -->
</modules>
<properties>
<global.version>0.0.1-SNAPSHOT</global.version>
</properties>
<build>
<!-- use maven exec plugin to run a shell script which generates the tar ball picking jars and config files from different modules target dirs -->
<plugins>
</plugins>
</build>
<profile>
</profiles>一个示例子模块pom
<groupId>com.test</groupId>
<artifactId>moduleC</artifactId>
<packaging>bundle</packaging>
<version>${global.version}</version>
<name>test :: ${project.artifactId} :: ${name} </name>
<parent>
<groupId>com.test</groupId>
<artifactId>parent</artifactId>
<version>${global.version}</version>
<relativePath>../parent</relativePath>
</parent>我尝试过的事情:
1)我可以分成多个配置文件并调用它们作为-Pprofile-1,profile-2吗?
它对我不起作用,但我会做一些错误的事情。
2)使用另一个包含mvn命令行的shell脚本,以不同的方式构建moduleC。
在构建应用程序之前,我尝试进行"-N“构建,将父pom放入存储库中,但没有帮助。
发布于 2017-09-22 06:59:25
最好的方法是:
mvn clean install --projects moduleA, moduleB
mvn clean install --projects moduleB, moduleC不能使用maven (see this stackoverflow question)运行多个构建
https://stackoverflow.com/questions/35280195
复制相似问题