Java 如何通过settings.xml覆盖pom.xml概要文件定义来激活maven概要文件?

Java 如何通过settings.xml覆盖pom.xml概要文件定义来激活maven概要文件?,java,maven,profiles,Java,Maven,Profiles,我正在尝试启用一个maven概要文件,如下示例所示。通过pom.xml中的以下代码,它可以很好地工作: <project> ... <build> <plugins> <plugin> <groupId>org.myco.plugins</groupId> <artifactId>spiffy-integrationTest-plugin</art

我正在尝试启用一个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>
问题是,如果我尝试更改激活方式:如果我尝试使用属性或
activeByDefault
标记激活settings.xml上的profiles,那么它不会执行任何操作。如果我尝试在pom上以相同的方式激活配置文件,它会工作,但属性不会被覆盖


如何继续?

您所说的“如果我尝试使用属性或activeByDefault标记激活settings.xml上的配置文件,它什么也不做”是什么意思?您可以发布您的不同尝试吗?第一次尝试:删除
activeProfiles
标记,并在setting.xml上的配置文件中添加
activationByDefault
标记。在本例中,maven似乎激活了概要文件,但只激活了settings.xml中配置的部分,而忽略了pom.xml中的部分。第二次尝试:在pom.xml上的概要文件中添加
activationByDefault
标记。在本例中,maven正确激活了配置文件,但没有替换属性(就好像没有读取settings.xml上的配置文件一样)。我最终解决了创建两个不同的配置文件的问题,一个在pom.xml中,配置由属性激活,另一个在settings.xml中,由设置appserver.home属性的相同属性激活。但这似乎更多的是一种变通办法,而不是解决方案。
<settings>
  ...
  <profiles>
    <profile>
      <id>appserverConfig</id>
      <properties>
        <appserver.home>/path/to/appserver</appserver.home>
      </properties>
    </profile>
  </profiles>

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