Class PedanticDependencyScopeEnforcer
java.lang.Object
com.github.ferstl.maven.pomenforcers.AbstractPedanticEnforcer
com.github.ferstl.maven.pomenforcers.PedanticDependencyScopeEnforcer
- All Implemented Interfaces:
org.apache.maven.enforcer.rule.api.EnforcerRule,org.apache.maven.enforcer.rule.api.EnforcerRule2
Enforces that the configured dependencies have to be defined within a specific scope.
Wildcards are supported in the following formats (see example below):
- Full wildcard: "*", matches everything
- Leading wildcard: "*foo", matches everything that ends with "foo"
- Trailing wildcard: "foo*", matches everything that starts with "foo"
- Containing wildcard: "*foo*", matches everything that contains with "foo"
### Example
<rules>
<dependencyScope implementation="com.github.ferstl.maven.pomenforcers.PedanticDependencyScopeEnforcer">
<!-- These dependencies can only be defined in test scope -->
<testDependencies>junit:junit,org.hamcrest:*,org.mockito:mockito-core</testDependencies>
<!-- These dependencies can only be defined in provided scope -->
<providedDependencies>javax.servlet:servlet-api</providedDependencies>
</dependencyScope>
</rules>
- Since:
- 1.0.0
- Enforcer Rule ID:
PedanticEnforcerRule.DEPENDENCY_SCOPE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaccept(PedanticEnforcerVisitor visitor)protected voiddoEnforce(ErrorReport report)protected PedanticEnforcerRulevoidsetCompileDependencies(String compileDependencies)Comma-separated list ofcompilescope dependencies in the formatgroupId:artifactId.voidsetImportDependencies(String importDependencies)Comma-separated list ofimportscope dependencies in the formatgroupId:artifactId.voidsetProvidedDependencies(String providedDependencies)Comma-separated list ofprovidedscope dependencies in the formatgroupId:artifactId.voidsetRuntimeDependencies(String runtimeDependencies)Comma-separated list ofruntimescope dependencies in the formatgroupId:artifactId.voidsetSystemDependencies(String systemDependencies)Comma-separated list ofsystemscope dependencies in the formatgroupId:artifactId.voidsetTestDependencies(String testDependencies)Comma-separated list oftestscope dependencies in the formatgroupId:artifactId.Methods inherited from class com.github.ferstl.maven.pomenforcers.AbstractPedanticEnforcer
execute, getCacheId, getHelper, getLevel, getPom, getProjectModel, isCacheable, isResultValid
-
Constructor Details
-
PedanticDependencyScopeEnforcer
public PedanticDependencyScopeEnforcer()
-
-
Method Details
-
setCompileDependencies
Comma-separated list ofcompilescope dependencies in the formatgroupId:artifactId.- Parameters:
compileDependencies- Comma-separated list ofcompilescope dependencies.- Since:
- 1.0.0
- Enforcer Configuration Parameter
-
setProvidedDependencies
Comma-separated list ofprovidedscope dependencies in the formatgroupId:artifactId.- Parameters:
providedDependencies- Comma-separated list ofprovidedscope dependencies.- Since:
- 1.0.0
- Enforcer Configuration Parameter
-
setRuntimeDependencies
Comma-separated list ofruntimescope dependencies in the formatgroupId:artifactId.- Parameters:
runtimeDependencies- Comma-separated list ofruntimescope dependencies.- Since:
- 1.0.0
- Enforcer Configuration Parameter
-
setSystemDependencies
Comma-separated list ofsystemscope dependencies in the formatgroupId:artifactId.- Parameters:
systemDependencies- Comma-separated list ofsystemscope dependencies.- Since:
- 1.0.0
- Enforcer Configuration Parameter
-
setTestDependencies
Comma-separated list oftestscope dependencies in the formatgroupId:artifactId.- Parameters:
testDependencies- Comma-separated list oftestscope dependencies.- Since:
- 1.0.0
- Enforcer Configuration Parameter
-
setImportDependencies
Comma-separated list ofimportscope dependencies in the formatgroupId:artifactId.- Parameters:
importDependencies- Comma-separated list ofimportscope dependencies.- Since:
- 1.0.0
- Enforcer Configuration Parameter
-
getDescription
- Specified by:
getDescriptionin classAbstractPedanticEnforcer
-
accept
- Specified by:
acceptin classAbstractPedanticEnforcer
-
doEnforce
- Specified by:
doEnforcein classAbstractPedanticEnforcer
-