Skip to content

PedanticPluginConfigurationEnforcer

Stefan Ferstl edited this page Jul 16, 2023 · 13 revisions

Since: 1.0.0

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>

Configuration Options

Option Default Description
warnOnly false If set to true, the enforcer rule will only issue a warning in the log and not fail the build. Enabling this option is a good way to start using the enforcer rules in an already existing project. Since: 2.0.0
manageVersions true Enforces plugin versions to be defined in <pluginManagement>. Since: 1.0.0
allowUnmanagedProjectVersions true If set to true, <version>${project.version}</version> may be used within the pluginManagement section. Since: 2.2.0
allowedUnmanagedProjectVersionProperties project.version,version Comma-separated list of Maven property variable names (without ${...}) which are allowed to be used as version references outside pluginManagement. Has no effect if allowUnmanagedProjectVersions is set to false. Since: 2.2.0
manageConfigurations true Enforces plugin configuration to be defined in <pluginManagement>. Since: 1.0.0
manageDependencies true Enforces plugin dependencies to be defined in <pluginManagement>. Since: 1.0.0