【发布时间】:2014-11-25 10:27:11
【问题描述】:
我正在使用基于我的 pom.xml 中存在的文件的激活。
但是,无论如何,我的个人资料总是被执行。
这是个人资料描述:
<profile>
<id>copy</id>
<activation>
<file>
<exists>file.xml</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<configuration>
<target name="copy and rename file">
<copy file="${basedir}/src/main/resources/application.${env}.properties" tofile="${basedir}/src/main/fabric8/io.fabric8.system.properties" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
我这样称呼我的个人资料: mvn package -Pcopy
但无论文件是否存在,配置文件都会被调用。 我做错了什么?
谢谢 罗曼。
【问题讨论】:
-
在@manouti's answer 之后,考虑激活配置文件而不是调用或执行它是有利的。这种匹配更好地符合 POM 的声明性性质,而不是强制性质。也许你已经意识到它已经通过 POM 激活了。 ;-)
标签: java maven maven-plugin activation