【发布时间】:2020-07-21 06:06:21
【问题描述】:
我有主 pom.xml 我喜欢从我正在使用的主 mvn 命令行 cli 更改并更改:
<argument>${docker.image}</argument>
参数仅在子模块中: module_y 配置文件不是 module_x
这是我现在正在执行的命令:
mvn clean install -Ddocker_build=build
<artifactId>foo</artifactId>
<version>b1</version>
<packaging>pom</packaging>
<properties>
<docker.image>www.repo.org:8000/${project.artifactId}:${project.version}</docker.image>
</properties>
<modules>
<module>module_x</module>
<module>module_y</module>
</modules>
这是 module_x 和 module_y 中的部分
<profiles>
<profile>
<activation>
<property>
<name>docker_build</name>
<value>build</value>
</property>
<file>
<exists>Dockerfile</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<phase>install</phase>
<configuration>
<executable>docker</executable>
<arguments>
<argument>build</argument>
<argument>-f</argument>
<argument>${project.basedir}/Dockerfile</argument>
<argument>-t</argument>
<argument>${docker.image}</argument>
<argument>.</argument>
</arguments>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
简而言之,我如何从主 mvn 运行中仅更改 module_y 中配置文件 docker_build 中的属性值 ${docker.image}?
【问题讨论】:
-
您需要为此更改 POM。这是个问题吗?
-
是的,我不能全部
标签: maven