gpt4 book ai didi

maven - maven 配置文件 ID 如何使用 var?

转载 作者:行者123 更新时间:2023-12-02 15:38:43 25 4
gpt4 key购买 nike

简介是:我使用 ${artifactId} 作为配置文件 ID。

 <profiles>
<profile>
<id>${artifactId}</id>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.3</version>
<configuration>
<descriptors>
<descriptor>distribution.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

在 shell 中运行 maven:mvn -U -Dmaven.test.skip=true -f pom.xml -Pabc_test 全新安装

然后我发现了一个错误:

[WARNING] The requested profile "abc_test" could not be activated because it does not exist. Finish

最佳答案

您必须在 pom.xml 中定义所有配置文件。

    <profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<war.name>dev</war.name>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<war.name>prod</war.name>
</properties>
</profile>
</profiles>

这里的配置文件名称是devprod。您可以使用 ${war.name} 作为配置文件修改的变量。

关于maven - maven 配置文件 ID 如何使用 var?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12384322/

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