J Fabian Meier
J Fabian Meier

Reputation: 35785

Run Maven enforcer rule without a build

Can I run a maven enforcer rule on a project without adding it to the POM?

In other words: Can I specify an enforcer rule on the command line and run it independently from a build?

Use case: On the build server, I would like to run a rule before the build so that it fails fast. As we have 1800+ separate Java projects, updating the POMs or parent POMs is no fun.

Upvotes: 3

Views: 456

Answers (1)

hakamairi
hakamairi

Reputation: 4678

Strating from 3.0.0 it should be working like this

mvn enforcer:enforce -Drules=alwaysPass,alwaysFail

The actual ticket for that feature: https://issues.apache.org/jira/browse/MENFORCER-142

Documentation: https://github.com/apache/maven-enforcer/pull/36#issuecomment-431807499

Upvotes: 2

Related Questions