Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MENFORCER-480] BanDynamicVersions: fix ignores parameter #269

Merged
merged 2 commits into from
May 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ private static final class ExcludeArtifactPatternsPredicate implements Predicate

@Override
public boolean test(DependencyNode depNode) {
return artifactMatcher.match(ArtifactUtils.toArtifact(depNode));
return !artifactMatcher.match(ArtifactUtils.toArtifact(depNode));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
<excludedScope>test</excludedScope>
</excludedScopes>
<allowRangesWithIdenticalBounds>true</allowRangesWithIdenticalBounds>
<ignores>
<ignore>*:menforcer134_project</ignore>
</ignores>
</banDynamicVersions>
</rules>
</configuration>
Expand Down Expand Up @@ -109,6 +112,12 @@
<!-- version range syntax with equal upper and lower bounds -->
<version>[1.0]</version>
</dependency>
<dependency>
<!-- banned SNAPSHOT, but ignored (though it's transitive dependency on menforcer134_modelbuilder is not) -->
<groupId>org.apache.maven.plugins.enforcer.its</groupId>
<artifactId>menforcer134_project</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ assert buildLog.text.contains( '[ERROR] Dependency org.apache.maven.plugins.enfo
assert buildLog.text.contains( '[ERROR] Dependency org.apache.maven.plugins.enforcer.its:menforcer138_io:jar:LATEST (compile) is referenced with a banned dynamic version LATEST' )
assert buildLog.text.contains( '[ERROR] Dependency org.apache.maven.plugins.enforcer.its:menforcer134_model:jar:1.0-SNAPSHOT (compile) is referenced with a banned dynamic version 1.0-SNAPSHOT' )
assert buildLog.text.contains( '[ERROR] Dependency org.apache.maven.plugins.enforcer.its:menforcer427-a:jar:1.0 (compile) via org.apache.maven.plugins.enforcer.its:menforcer427:jar:1.0 is referenced with a banned dynamic version [1.0,2)' )
assert buildLog.text.contains( 'Dependency org.apache.maven.plugins.enforcer.its:menforcer134_modelbuilder:jar:1.0-SNAPSHOT (compile) via org.apache.maven.plugins.enforcer.its:menforcer134_project:jar:1.0-SNAPSHOT is referenced with a banned dynamic version 1.0-SNAPSHOT' )
assert buildLog.text.contains( '[ERROR] Rule 0: org.apache.maven.enforcer.rules.dependency.BanDynamicVersions failed with message' )
assert buildLog.text.contains( 'ERROR] Found 4 dependencies with dynamic versions.' )
assert buildLog.text.contains( 'ERROR] Found 5 dependencies with dynamic versions.' )