gpt4 book ai didi

java - 使用文件存在忽略我的 Maven 配置文件中的激活(配置文件始终执行)

转载 作者:行者123 更新时间:2023-11-29 03:16:43 25 4
gpt4 key购买 nike

我正在使用基于我的 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 包 -Pcopy

但是无论文件是否存在,配置文件总是被调用。我做错了什么?

谢谢罗曼。

最佳答案

如果该文件存在于项目中,则在运行mvn 命令时不需要传递配置文件名称。将 -Pcopy 显式传递给命令将覆盖 POM 中的 activation,并将始终激活此配置文件。

请参阅此 link 中的如何触发配置文件部分.

关于java - 使用文件存在忽略我的 Maven 配置文件中的激活(配置文件始终执行),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26126828/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com