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
LATESTorRELEASEor - versions ending with
-SNAPSHOT.
- Since:
- 3.2.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate final classprivate static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleantrueif versions usingLATESTshould be allowedprivate booleantrueif version ranges should be allowedprivate booleantrueif ranges having the same upper and lower bound like[1.0]should be allowed.private booleantrueif versions usingRELEASEshould be allowedprivate booleantrueif versions ending with-SNAPSHOTshould be allowedthe scopes of dependencies which should be excluded from this ruleprivate booleantrueif optional dependencies should not be checkedSpecify the ignored dependencies.private static final Stringprivate static final Stringprivate final ResolverUtilprivate static final String -
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 StringdumpIntermediatePath(Collection<org.eclipse.aether.graph.DependencyNode> path) voidexecute()This is the interface into the rule.toString()Methods inherited from class org.apache.maven.enforcer.rules.AbstractStandardEnforcerRule
formatLocation, getMessage, setMessageMethods inherited from class org.apache.maven.enforcer.rule.api.AbstractEnforcerRule
getCacheId, getLevelMethods 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 allowSnapshotstrueif versions ending with-SNAPSHOTshould be allowed -
allowLatest
private boolean allowLatesttrueif versions usingLATESTshould be allowed -
allowRelease
private boolean allowReleasetrueif versions usingRELEASEshould be allowed -
allowRanges
private boolean allowRangestrueif version ranges should be allowed -
allowRangesWithIdenticalBounds
private boolean allowRangesWithIdenticalBoundstrueif ranges having the same upper and lower bound like[1.0]should be allowed. Only applicable ifallowRangesis not set totrue. -
excludeOptionals
private boolean excludeOptionalstrueif 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. -
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:AbstractEnforcerRuleThis 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:
executein classAbstractEnforcerRule- Throws:
EnforcerRuleException- the enforcer rule exception
-
dumpIntermediatePath
private static String dumpIntermediatePath(Collection<org.eclipse.aether.graph.DependencyNode> path) -
collectDependenciesWithBannedDynamicVersions
private List<String> collectDependenciesWithBannedDynamicVersions(org.eclipse.aether.graph.DependencyNode rootDependency) throws org.eclipse.aether.collection.DependencyCollectionException - Throws:
org.eclipse.aether.collection.DependencyCollectionException
-
toString
-