如何通过settings.xml覆盖pom.xml配置文件定义来激活maven配置文件?

时间:2015-02-25 18:36:08

标签: java maven profiles

我尝试按照maven site中的示例启用maven个人资料。它以这种方式工作正常,这个代码在pom.xml中:

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.myco.plugins</groupId>
        <artifactId>spiffy-integrationTest-plugin</artifactId>
        <version>1.0</version>
        <configuration>
          <appserverHome>${appserver.home}</appserverHome>
        </configuration>
      </plugin>
      ...
    </plugins>
  </build>
  ...
</project>

此代码位于本地~/.m2/settings.xml

<settings>
  ...
  <profiles>
    <profile>
      <id>appserverConfig</id>
      <properties>
        <appserver.home>/path/to/appserver</appserver.home>
      </properties>
    </profile>
  </profiles>

  <activeProfiles>
    <activeProfile>appserverConfig</activeProfile>
  </activeProfiles>
  ...
</settings>

问题是如果我尝试更改激活方式:如果我尝试使用属性或activeByDefault标记激活settings.xml上的配置文件,它什么都不做。如果我尝试在pom上以相同的方式激活配置文件它可以工作,但属性不会覆盖。

我该怎么办?

0 个答案:

没有答案