Class BanDynamicVersions
java.lang.Object
org.apache.maven.enforcer.rule.api.AbstractEnforcerRuleBase
org.apache.maven.enforcer.rule.api.AbstractEnforcerRule
org.apache.maven.enforcer.rules.AbstractStandardEnforcerRule
org.apache.maven.enforcer.rules.dependency.BanDynamicVersions
- All Implemented Interfaces:
EnforcerRuleBase
@Named("banDynamicVersions")
public final class BanDynamicVersions
extends AbstractStandardEnforcerRule
This rule bans dependencies having a version which requires resolution (i.e. dynamic versions which might change with
each build). Dynamic versions are either
- version ranges,
- the special placeholders
LATEST
orRELEASE
or - versions ending with
-SNAPSHOT
.
- Since:
- 3.2.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final class
private static final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
true
if versions usingLATEST
should be allowedprivate boolean
true
if version ranges should be allowedprivate boolean
true
if ranges having the same upper and lower bound like[1.0]
should be allowed.private boolean
true
if versions usingRELEASE
should be allowedprivate boolean
true
if versions ending with-SNAPSHOT
should be allowedthe scopes of dependencies which should be excluded from this ruleprivate boolean
true
if optional dependencies should not be checkedSpecify the ignored dependencies.private static final String
private static final String
private final ResolverUtil
private static final String
private boolean
true
if dependencies should be checked before Maven computes the final dependency tree. -
Constructor Summary
ConstructorsConstructorDescriptionBanDynamicVersions
(org.apache.maven.project.MavenProject project, org.eclipse.aether.RepositorySystem repoSystem, org.apache.maven.execution.MavenSession mavenSession, ResolverUtil resolverUtil) -
Method Summary
Modifier and TypeMethodDescriptioncollectDependenciesWithBannedDynamicVersions
(org.eclipse.aether.graph.DependencyNode rootDependency) private static String
dumpIntermediatePath
(Collection<org.eclipse.aether.graph.DependencyNode> path) void
execute()
This is the interface into the rule.void
setVerbose
(boolean verbose) toString()
Methods inherited from class org.apache.maven.enforcer.rules.AbstractStandardEnforcerRule
formatLocation, getMessage, setMessage
Methods inherited from class org.apache.maven.enforcer.rule.api.AbstractEnforcerRule
getCacheId, getLevel, getRuleName
Methods inherited from class org.apache.maven.enforcer.rule.api.AbstractEnforcerRuleBase
getLog, setLog
-
Field Details
-
RELEASE
- See Also:
-
LATEST
- See Also:
-
SNAPSHOT_SUFFIX
- See Also:
-
allowSnapshots
private boolean allowSnapshotstrue
if versions ending with-SNAPSHOT
should be allowed -
allowLatest
private boolean allowLatesttrue
if versions usingLATEST
should be allowed -
allowRelease
private boolean allowReleasetrue
if versions usingRELEASE
should be allowed -
allowRanges
private boolean allowRangestrue
if version ranges should be allowed -
allowRangesWithIdenticalBounds
private boolean allowRangesWithIdenticalBoundstrue
if ranges having the same upper and lower bound like[1.0]
should be allowed. Only applicable ifallowRanges
is not set totrue
. -
excludeOptionals
private boolean excludeOptionalstrue
if optional dependencies should not be checked -
excludedScopes
the scopes of dependencies which should be excluded from this rule -
ignores
Specify the ignored dependencies. This can be a list of artifacts in the formatgroupId[:artifactId[:version[:type[:scope:[classifier]]]]]
. Any of the sections can be a wildcard by using '*' (e.g.group:*:1.0
).
Any of the ignored dependencies may have dynamic versions. -
verbose
private boolean verbosetrue
if dependencies should be checked before Maven computes the final dependency tree. Setting this property will make the rule check dependencies before any conflicts are resolved. This is similar to theverbose
parameter for thetree
goal formaven-dependency-plugin
. -
resolverUtil
-
-
Constructor Details
-
BanDynamicVersions
@Inject public BanDynamicVersions(org.apache.maven.project.MavenProject project, org.eclipse.aether.RepositorySystem repoSystem, org.apache.maven.execution.MavenSession mavenSession, ResolverUtil resolverUtil)
-
-
Method Details
-
execute
Description copied from class:AbstractEnforcerRule
This is the interface into the rule. This method should throw an exception containing a reason message if the rule fails the check. The plugin will then decide based on the fail flag and rule level if it should stop or just log the message as a warning.- Specified by:
execute
in classAbstractEnforcerRule
- Throws:
EnforcerRuleException
- the enforcer rule exception
-
dumpIntermediatePath
private static String dumpIntermediatePath(Collection<org.eclipse.aether.graph.DependencyNode> path) -
collectDependenciesWithBannedDynamicVersions
-
setVerbose
public void setVerbose(boolean verbose) -
toString
-