这是我使用 Maven 构建配置文件的第一天。我在以下文件中有个人资料:
- pom.xml
- Maven 设置 (%USER_HOME%/.m2/settings.xml)
出于好奇,我在两个文件中创建了一个具有相同 id(local_deploy) 的配置文件,唯一的区别在于一个属性(例如 tomcat.pwd)。
POM 中的配置文件如下所示:
<profile>
<id>local_deploy</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<tomcat.host>localhost</tomcat.host>
<tomcat.port>8080</tomcat.port>
<tomcat.url>http://${tomcat.host}:${tomcat.port}/manager/text</tomcat.url>
<tomcat.user>admin</tomcat.user>
<tomcat.pwd>admin</tomcat.pwd>
</properties>
</profile>
Maven 设置中的配置文件如下所示:
<profile>
<id>local_deploy</id>
<properties>
<tomcat.host>localhost</tomcat.host>
<tomcat.port>8080</tomcat.port>
<tomcat.url>http://${tomcat.host}:${tomcat.port}/manager/text</tomcat.url>
<tomcat.user>admin</tomcat.user>
<tomcat.pwd>wrongpwd</tomcat.pwd>
</properties>
</profile>
请注意,Maven 设置中的配置文件未列在<activeProfiles>
.
当我尝试使用以下命令安装我的应用程序时
mvn clean install -P local_deploy help:active-profiles
我的应用程序在控制台上使用以下输出进行部署:
The following profiles are active:
local_deploy (source: external)
local_deploy (source: <my groupId>:<my artifactId><version>)
我正在浏览这个文档,它说
Take note that profiles in the settings.xml takes higher priority than profiles in the POM
所以,我假设我的部署应该因为 Maven 设置中的密码不正确而失败。我在这里想念什么?