[英]How to pass maven “--also-make” option via pom.xml to command line
假设有一个父项目A,其pom.xml中具有模块B和C。
Project A
|-pom.xml
|----------->ModuleB
| |->pom.xml
|----------->ModuleC
| |->pom.xml
<modules>
<module>B</module>
<module>C</module>
</modules>
模块C本身具有某些依赖性,该依赖性仅属于此子模块。 此依赖项应在模块C之前构建,因此当C调用“ mvn install”时,我想调用“ -am”(-also-make)选项。
Maven正在远程执行,我所拥有的只是pom文件。 构建作业在远程Jenkins上运行,它使用项目A父pom中的当前配置文件,仅必须使用此配置文件。
我虽然可以在模块C的pom中完成,例如在maven-compiler-plugin的配置中?
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${jdk.source}</source>
<target>${jdk.target}</target>
**<arguments>-am</arguments>** <!--smth like this maybe?-->
</configuration>
</plugin>
我还考虑过创建另一个pom.xml,使其仅以正确的顺序具有子模块C及其依赖项,并在父pom中代替当前的子模块C使用,但想首先尝试-am选项。 此外,我现在还不太清楚将这个新pom放在哪里,因为我们已经处于父A级。
可能应该重构整个项目的结构,但这是我目前所拥有的。
更新:以下是当前项目结构的简化程度较低的项目。
Project A (maven parent for B, C, D)
|-pom.xml
|----------->ModuleB
| |->pom.xml
|----------->folder
|----------->folder
|----------->ModuleC
| |->pom.xml
|----------->ModuleD
| |->pom.xml
<modules>
<module>B</module>
<!-- <module>D</module> | initially was here, now needs to be only C's dependency -->
<module>C</module>
</modules>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.