Class PedanticPluginConfigurationEnforcer
java.lang.Object
com.github.ferstl.maven.pomenforcers.AbstractPedanticEnforcer
com.github.ferstl.maven.pomenforcers.PedanticPluginConfigurationEnforcer
- All Implemented Interfaces:
org.apache.maven.enforcer.rule.api.EnforcerRule,org.apache.maven.enforcer.rule.api.EnforcerRule2,org.apache.maven.enforcer.rule.api.EnforcerRuleBase
Enforces that plugin versions, configurations and dependencies are defined in the
<pluginManagement> section. Plugin <executions> can still
be configured in the <plugins> section if this enforcer is active.
### Example
<rules>
<pluginConfiguration implementation="com.github.ferstl.maven.pomenforcers.PedanticPluginConfigurationEnforcer">
<!-- all plugin versions have to be defined in plugin managment. -->
<manageVersions>true</manageVersions>
<!-- allow property references such as ${project.version} as versions outside plugin management -->
<allowUnmanagedProjectVersions>true</allowUnmanagedProjectVersions>
<!-- set the allowed property names for the allowUnmanagedProjectVersions option -->
<allowedUnmanagedProjectVersionProperties>some-property.version,some-other.version</allowedUnmanagedProjectVersionProperties>
<!-- plugin configuration (except execution configuration) has to be defined in plugin management. -->
<manageConfigurations>true</manageConfigurations>
<!-- plugin dependencies may be defined in the <plugins> section. -->
<manageDependencies>false</manageDependencies>
</pluginConfiguration>
</rules>
- Since:
- 1.0.0
- Enforcer Rule ID:
PedanticEnforcerRule.PLUGIN_CONFIGURATION
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaccept(PedanticEnforcerVisitor visitor) protected voiddoEnforce(ErrorReport report) protected PedanticEnforcerRulevoidsetAllowedUnmanagedProjectVersionProperties(String allowedUnmanagedProjectVersionProperties) Comma-separated list of Maven property variable names (without ${...}) which are allowed to be used as version references outsidepluginManagement.voidsetAllowUnmanagedProjectVersions(boolean allowUnmanagedProjectVersions) If set totrue,may be used within the${project.version} pluginManagementsection.voidsetManageConfigurations(boolean manageConfigurations) Enforces pluginconfigurationto be defined in<pluginManagement>.voidsetManageDependencies(boolean manageDependencies) Enforces plugin dependencies to be defined in<pluginManagement>.voidsetManageVersions(boolean manageVersions) Enforces plugin versions to be defined in<pluginManagement>.Methods inherited from class com.github.ferstl.maven.pomenforcers.AbstractPedanticEnforcer
execute, getCacheId, getHelper, getLevel, getPom, getProjectModel, isCacheable, isResultValidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.maven.enforcer.rule.api.EnforcerRuleBase
setLog
-
Constructor Details
-
PedanticPluginConfigurationEnforcer
public PedanticPluginConfigurationEnforcer()
-
-
Method Details
-
setManageVersions
public void setManageVersions(boolean manageVersions) Enforces plugin versions to be defined in<pluginManagement>.- Parameters:
manageVersions- Enforces plugin versions to be defined in<pluginManagement>.- Since:
- 1.0.0
- Enforcer Configuration Parameter
- Default Value:
true
-
setAllowUnmanagedProjectVersions
public void setAllowUnmanagedProjectVersions(boolean allowUnmanagedProjectVersions) If set totrue,may be used within the${project.version} pluginManagementsection.- Parameters:
allowUnmanagedProjectVersions- Allow project versions outside of the<pluginManagement>section.- Since:
- 2.2.0
- Enforcer Configuration Parameter
- Default Value:
true
-
setAllowedUnmanagedProjectVersionProperties
public void setAllowedUnmanagedProjectVersionProperties(String allowedUnmanagedProjectVersionProperties) Comma-separated list of Maven property variable names (without ${...}) which are allowed to be used as version references outsidepluginManagement. Has no effect ifallowUnmanagedProjectVersionsis set tofalse.- Parameters:
allowedUnmanagedProjectVersionProperties- Set allowed property references for allowUnmanagedProjectVersions option.- Since:
- 2.2.0
- Enforcer Configuration Parameter
- Default Value:
project.version,version
-
setManageConfigurations
public void setManageConfigurations(boolean manageConfigurations) Enforces pluginconfigurationto be defined in<pluginManagement>.- Parameters:
manageConfigurations- Enforces pluginconfigurationto be defined in<pluginManagement>.- Since:
- 1.0.0
- Enforcer Configuration Parameter
- Default Value:
true
-
setManageDependencies
public void setManageDependencies(boolean manageDependencies) Enforces plugin dependencies to be defined in<pluginManagement>.- Parameters:
manageDependencies- Enforces plugin<dependencies>to be defined in<pluginManagement>.- Since:
- 1.0.0
- Enforcer Configuration Parameter
- Default Value:
true
-
getDescription
- Specified by:
getDescriptionin classAbstractPedanticEnforcer
-
accept
- Specified by:
acceptin classAbstractPedanticEnforcer
-
doEnforce
- Specified by:
doEnforcein classAbstractPedanticEnforcer
-