Skip to content

Commit

Permalink
Attach enforcer rules to enforce-rules execution
Browse files Browse the repository at this point in the history
Putting them into global configuration causes them to be
appended to every execution of the enforcer plugin, which
means they get run multiple times if a downstream project
includes additional executions to perform additional checks.
  • Loading branch information
ctrueden committed Jun 3, 2024
1 parent d579d0a commit 2952e19
Showing 1 changed file with 97 additions and 97 deletions.
194 changes: 97 additions & 97 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -859,106 +859,106 @@
<goals>
<goal>enforce</goal>
</goals>
</execution>
</executions>
<configuration>
<rules>
<!--
Standard Rules
https://maven.apache.org/enforcer/enforcer-rules/
-->
<requireMavenVersion>
<version>${scijava.mvn.version}</version>
</requireMavenVersion>
<requirePluginVersions>
<message>Plugins need to be versioned!</message>
</requirePluginVersions>
<requireJavaVersion>
<version>${scijava.jvm.build.version}</version>
</requireJavaVersion>

<!--
Extra Enforcer Rules
org.codehaus.mojo:extra-enforcer-rules
https://www.mojohaus.org/extra-enforcer-rules/
-->

<!--
Ensure no two dependencies ship the same class.
Otherwise, much havoc may be wreaked at runtime.
-->
<banDuplicateClasses>
<message>No Duplicate Classes Allowed!
<configuration>
<rules>
<!--
Standard Rules
https://maven.apache.org/enforcer/enforcer-rules/
-->
<requireMavenVersion>
<version>${scijava.mvn.version}</version>
</requireMavenVersion>
<requirePluginVersions>
<message>Plugins need to be versioned!</message>
</requirePluginVersions>
<requireJavaVersion>
<version>${scijava.jvm.build.version}</version>
</requireJavaVersion>

<!--
Extra Enforcer Rules
org.codehaus.mojo:extra-enforcer-rules
https://www.mojohaus.org/extra-enforcer-rules/
-->

<!--
Ensure no two dependencies ship the same class.
Otherwise, much havoc may be wreaked at runtime.
-->
<banDuplicateClasses>
<message>No Duplicate Classes Allowed!
- For duplicate transitive dependencies, add dependency exclusions.
- For duplications between direct dependencies, resolve or add
ignored classes to this rule's configuration.</message>
<findAllDuplicates>true</findAllDuplicates>
<ignoreClasses>${allowedDuplicateClasses}</ignoreClasses>
</banDuplicateClasses>

<!--
Require developers and contributors to use SciJava team roles.
See: https://imagej.net/Team
-->
<requireDeveloperRoles>
<validRoles>${scijava.team.roles}</validRoles>
</requireDeveloperRoles>
<requireContributorRoles>
<validRoles>${scijava.team.roles}</validRoles>
</requireContributorRoles>

<!--
Fail if a dependency requires a too-new version of Java.
-->
<enforceBytecodeVersion>
<maxJdkVersion>${scijava.jvm.version}</maxJdkVersion>
<excludes>
<exclude>com.headius:invokebinder</exclude>
<exclude>com.sun:tools</exclude>
</excludes>
<ignoreClasses>
<ignoreClass>module-info</ignoreClass>
</ignoreClasses>
<ignoredScopes>
<ignoredScope>test</ignoredScope>
</ignoredScopes>
</enforceBytecodeVersion>

<!--
SciJava Maven Plugin
org.scijava:scijava-maven-plugin
https://github.com/scijava/scijava-maven-plugin
-->

<!-- Require inheriting POMs to populate key elements. -->
<requireElements implementation="org.scijava.maven.plugin.enforcer.RequireElements">
<elements>
<element>name</element>
<element>description</element>
<element>url</element>
<element>inceptionYear</element>
<element>organization</element>
<element>licenses</element>
<element>developers</element>
<element>contributors</element>
<element>mailingLists</element>
<element>scm</element>
<element>issueManagement</element>
<element>ciManagement</element>
<element>properties//license.licenseName</element>
<element>properties//license.copyrightOwners</element>
</elements>
</requireElements>

<!--
Require builds to be reproducible.
This means no snapshot dependencies!
-->
<requireReproducibleBuilds implementation="org.scijava.maven.plugin.enforcer.RequireReproducibleBuilds">
<groupIds>${scijava.groupIds}</groupIds>
</requireReproducibleBuilds>
</rules>
</configuration>
<findAllDuplicates>true</findAllDuplicates>
<ignoreClasses>${allowedDuplicateClasses}</ignoreClasses>
</banDuplicateClasses>

<!--
Require developers and contributors to use SciJava team roles.
See: https://imagej.net/Team
-->
<requireDeveloperRoles>
<validRoles>${scijava.team.roles}</validRoles>
</requireDeveloperRoles>
<requireContributorRoles>
<validRoles>${scijava.team.roles}</validRoles>
</requireContributorRoles>

<!--
Fail if a dependency requires a too-new version of Java.
-->
<enforceBytecodeVersion>
<maxJdkVersion>${scijava.jvm.version}</maxJdkVersion>
<excludes>
<exclude>com.headius:invokebinder</exclude>
<exclude>com.sun:tools</exclude>
</excludes>
<ignoreClasses>
<ignoreClass>module-info</ignoreClass>
</ignoreClasses>
<ignoredScopes>
<ignoredScope>test</ignoredScope>
</ignoredScopes>
</enforceBytecodeVersion>

<!--
SciJava Maven Plugin
org.scijava:scijava-maven-plugin
https://github.com/scijava/scijava-maven-plugin
-->

<!-- Require inheriting POMs to populate key elements. -->
<requireElements implementation="org.scijava.maven.plugin.enforcer.RequireElements">
<elements>
<element>name</element>
<element>description</element>
<element>url</element>
<element>inceptionYear</element>
<element>organization</element>
<element>licenses</element>
<element>developers</element>
<element>contributors</element>
<element>mailingLists</element>
<element>scm</element>
<element>issueManagement</element>
<element>ciManagement</element>
<element>properties//license.licenseName</element>
<element>properties//license.copyrightOwners</element>
</elements>
</requireElements>

<!--
Require builds to be reproducible.
This means no snapshot dependencies!
-->
<requireReproducibleBuilds implementation="org.scijava.maven.plugin.enforcer.RequireReproducibleBuilds">
<groupIds>${scijava.groupIds}</groupIds>
</requireReproducibleBuilds>
</rules>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
Expand Down

0 comments on commit 2952e19

Please sign in to comment.