This is an automated email from the ASF dual-hosted git repository. slachiewicz pushed a commit to branch MENFORCER-394 in repository https://gitbox.apache.org/repos/asf/maven-enforcer.git
commit 9d02aa41ceadd2274e7361697f7d9bfa278629bb Author: Joe Barnett <[email protected]> AuthorDate: Mon Aug 16 11:23:49 2021 -0700 [MENFORCER-394] Only look at shipped dependencies in DependencyConvergence This matches the 3.0.0-M3 behavior of the DependencyConvergence rule, including only non-optional compile and runtime dependencies. --- .../maven/plugins/enforcer/DependencyConvergence.java | 5 ++++- .../invoker.properties | 18 ------------------ 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/DependencyConvergence.java b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/DependencyConvergence.java index 2b9a46a..fdb95e0 100644 --- a/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/DependencyConvergence.java +++ b/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/DependencyConvergence.java @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import org.apache.maven.enforcer.rule.api.EnforcerRule; @@ -82,7 +83,9 @@ public class DependencyConvergence new DefaultProjectBuildingRequest( session.getProjectBuildingRequest() ); buildingRequest.setProject( project ); buildingRequest.setLocalRepository( repository ); - ArtifactFilter filter = null; // we need to evaluate all scopes + ArtifactFilter filter = ( Artifact a ) -> ( "compile".equalsIgnoreCase( a.getScope () ) + || "runtime".equalsIgnoreCase( a.getScope () ) ) + && !a.isOptional(); return dependencyCollectorBuilder.collectDependencyGraph( buildingRequest, filter ); } diff --git a/maven-enforcer-plugin/src/it/projects/dependencies_not_converging_test_scope/invoker.properties b/maven-enforcer-plugin/src/it/projects/dependencies_not_converging_test_scope/invoker.properties deleted file mode 100644 index c98ac4c..0000000 --- a/maven-enforcer-plugin/src/it/projects/dependencies_not_converging_test_scope/invoker.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -invoker.buildResult=failure \ No newline at end of file
