maven - > profile - >激活 - 所有条件都是必需的还是只有一个?

Hub*_*ert 7 java maven-3 maven

配置:
- Maven:3.0.5
- Java:1.6.0_45

描述:

假设我们有如下配置文件配置:

<profiles>
    <profile>
        <id>profile-1</id>
        <activation>
            <jdk>1.6</jdk>
            <property>
                <name>name</name>
                <value>Hubert</value>
            </property>
        </activation>
    </profile>
    <profile>
        <id>profile-2</id>
        <activation>
            <jdk>1.6</jdk>
            <property>
                <name>name</name>
                <value>Wiktoria</value>
            </property>
        </activation>
    </profile>
</profiles>
Run Code Online (Sandbox Code Playgroud)

我们有两个配置文件:profile-1和profile-2.

当满足两个要求时,配置文件profile-1应该是活动的:
- jdk是版本1.6
- 属性名称具有值Hubert

题:

我们来看看这个配置:

mvn -Dname = Hubert help:active-profiles

结果我得到了两个活动的配置文件:profile-1和profile-2.
嗯...
配置文件profile-2不应该处于活动状态,因为属性名称的值与预期的Wiktoria不同.

有人可以解释一下为什么这样的工作?这是正常的行为吗?
谢谢.

Mar*_*ler 6

这里的问题是连接触发条件的激活列表OR.他们确实有一张提供多个激活触发器的票证,但它仍然是开放的.这意味着,它匹配您的sdk规则,该规则是真实的,因此是活动的.

<profile>
    <id>profile-1</id>
    <activation> <!-- true || true = true -->
        <jdk>1.6</jdk> <!-- true -->
        <property> <!-- true -->
            <name>name</name>
            <value>Hubert</value>
        </property>
    </activation>
</profile>
<profile>
    <id>profile-2</id>
    <activation> <!-- true || false = true -->
        <jdk>1.6</jdk> <!-- true -->
        <property> <!-- false -->
            <name>name</name>
            <value>Wiktoria</value>
        </property>
    </activation>
</profile>
Run Code Online (Sandbox Code Playgroud)