Skip to content

Commit

Permalink
[MENFORCER-402] - fix provided dependencies in RequireUpperBoundDeps
Browse files Browse the repository at this point in the history
  • Loading branch information
subes authored May 28, 2022
1 parent dda1c21 commit 35ad6b4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ private DependencyNode getNode( EnforcerRuleHelper helper )
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 );
}
catch ( ExpressionEvaluationException e )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<groupId>org.apache.maven.plugins.enforcer.its</groupId>
<artifactId>menforcer128_classic</artifactId>
<version>0.9.9</version>
<scope>provided</scope>
<scope>compile</scope>
<!-- Depends on org.apache.maven.plugins.enforcer.its:menforcer128_api:1.5.0 -->
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ def message =
' +-org.apache.maven.plugins.enforcer.its:menforcer128_api:1.4.0 [runtime]'+LS+
'and'+LS+
'+-org.apache.maven.plugins.enforcer.its:menforcer313:1.0-SNAPSHOT'+LS+
' +-org.apache.maven.plugins.enforcer.its:menforcer128_classic:0.9.9 [provided]'+LS+
' +-org.apache.maven.plugins.enforcer.its:menforcer128_api:1.5.0 [provided]'+LS
' +-org.apache.maven.plugins.enforcer.its:menforcer128_classic:0.9.9'+LS+
' +-org.apache.maven.plugins.enforcer.its:menforcer128_api:1.5.0'+LS
assert buildLog.text.contains( message )

0 comments on commit 35ad6b4

Please sign in to comment.