dependency:analyze 与周期的 Maven 2 和 3 差异

Maven 2 & 3 differences on dependency:analyze with cycle

这是我正在使用的依赖关系树:

[INFO] ------------------------------------------------------------------------
[INFO] Building PA 0.0.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ PA ---
[INFO] myTest:PA:jar:0.0.2-SNAPSHOT
[INFO] \- PC:PC:jar:0.0.1-SNAPSHOT:compile
[INFO]    \- myTest:PA:jar:0.0.1-SNAPSHOT:compile

如您所见,有一个循环:

PA > PC > PA

使用 maven 2.2.1:

mvn dependency:analyze
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - myTest:PA:jar:0.0.2-SNAPSHOT
[INFO]    task-segment: [dependency:analyze]
[INFO] ------------------------------------------------------------------------
...
[INFO] No dependency problems found

使用 maven 3.3.3:

mvn dependency:analyze
[INFO] ------------------------------------------------------------------------
[INFO] Building PA 0.0.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
...
[INFO] --- maven-dependency-plugin:2.8:analyze (default-cli) @ PA ---
[WARNING] Used undeclared dependencies found:
[WARNING]    myTest:PA:jar:0.0.1-SNAPSHOT:compile

使用 maven 3 的分析要我将 PA 添加为对 PA 自身的依赖项。是否可以使用 Maven 3 获得与 Maven 2 相同的行为?

这是我使用 Maven 3 获得与 Maven 2 相同结果的解决方法:

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <configuration>
                    <ignoredDependencies>
                        <ignoredDependencie>${project.groupId}:${project.artifactId}::</ignoredDependencie>
                    </ignoredDependencies>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>