Maven Enforcer Custom Rules

A library of custom rules to use in maven enforcer plugin.

License

License

Categories

Categories

Maven Build Tools
GroupId

GroupId

io.github.89iuv
ArtifactId

ArtifactId

maven-enforcer-custom-rules
Last Version

Last Version

1.1.1
Release Date

Release Date

Type

Type

jar
Description

Description

Maven Enforcer Custom Rules
A library of custom rules to use in maven enforcer plugin.
Project URL

Project URL

https://github.com/89iuv/maven-enforcer-custom-rules
Source Code Management

Source Code Management

https://github.com/89iuv/maven-enforcer-custom-rules

Download maven-enforcer-custom-rules

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.89iuv/maven-enforcer-custom-rules/ -->
<dependency>
    <groupId>io.github.89iuv</groupId>
    <artifactId>maven-enforcer-custom-rules</artifactId>
    <version>1.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.89iuv/maven-enforcer-custom-rules/
implementation 'io.github.89iuv:maven-enforcer-custom-rules:1.1.1'
// https://jarcasting.com/artifacts/io.github.89iuv/maven-enforcer-custom-rules/
implementation ("io.github.89iuv:maven-enforcer-custom-rules:1.1.1")
'io.github.89iuv:maven-enforcer-custom-rules:jar:1.1.1'
<dependency org="io.github.89iuv" name="maven-enforcer-custom-rules" rev="1.1.1">
  <artifact name="maven-enforcer-custom-rules" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.89iuv', module='maven-enforcer-custom-rules', version='1.1.1')
)
libraryDependencies += "io.github.89iuv" % "maven-enforcer-custom-rules" % "1.1.1"
[io.github.89iuv/maven-enforcer-custom-rules "1.1.1"]

Dependencies

compile (4)

Group / Artifact Type Version
org.apache.maven.enforcer : enforcer-api jar 1.4.1
org.apache.maven : maven-core jar 3.5.3
org.apache.maven : maven-artifact jar 3.5.3
org.apache.maven : maven-plugin-api jar 3.5.3

test (3)

Group / Artifact Type Version
junit : junit jar 4.12
org.mockito : mockito-core jar 2.23.0
org.assertj : assertj-core jar 3.11.1

Project Modules

There are no modules declared in this project.

maven-enforcer-custom-rules

Custom Rules for Maven Enforcer Plugin

usage example

 <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-enforcer-plugin</artifactId>
    <version>1.4.1</version>
    <dependencies>
        <dependency>
            <groupId>io.github.89iuv</groupId>
            <artifactId>maven-enforcer-custom-rules</artifactId>
            <version>1.0.0</version>
        </dependency>
    </dependencies>
    <executions>
        <execution>
            <id>enforce-versions</id>
            <goals>
                <goal>enforce</goal>
            </goals>
            <configuration>
                <rules>
                    <myCustomRule implementation="io.github.eniuv.maven.enforcer.custom.rules.NonThreadSafePluginRule">
                        <!-- default: true - set this to "false" in order to include org.apache.maven.plugins plugins -->
                        <!-- the goals "site" and "deploy" from "maven-site-plugin:org.apache.maven.plugins" are reported as not thread safe and they need to be excluded -->
                        <excludeMavenPlugins>true</excludeMavenPlugins>
    
                        <!-- default: true - set this to "false" in order let the build pass with errors -->
                        <fail>true</fail>
    
                        <!--uncomment the following example section to add plugins to the exclusion list-->
                        <!-- <exclude>
                            <Plugin>
                                <groupId>org.codehaus.mojo</groupId>
                                <artifactId>javacc-maven-plugin</artifactId>
                                <version>2.6</version>
                            </Plugin>
                            <Plugin>
                                <groupId>nl.geodienstencentrum.maven</groupId>
                                <artifactId>sass-maven-plugin</artifactId>
                            </Plugin>
                        </exclude> -->
                    </myCustomRule>
                </rules>
            </configuration>
        </execution>
    </executions>
</plugin>

output sample

[INFO] NonThreadSafePluginRule: Exclude "org.apache.maven.plugins".
[ERROR] The Goal: "update-stylesheets" of Plugin: "sass-maven-plugin:nl.geodienstencentrum.maven:3.5.5" is not thread safe.
[ERROR] The Goal: "javacc" of Plugin: "javacc-maven-plugin:org.codehaus.mojo:2.6" is not thread safe.
[WARNING] Rule 1: io.github.eniuv.maven.enforcer.custom.rules.NonThreadSafePluginRule failed with message:
Use of non thread safe plugins is not allowed.
...
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce (enforce-versions) on project maven: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed. -> [Help 1]

Versions

Version
1.1.1
1.1.0
1.0.0