I am trying to setup the enforcer plugin for maven to enforce a minimum Java version. However, whenever I try to run mvn enforcer:enforce
, I get:
It may be that you are using invalid rule names. Check out the rules page. The rule names are case sensitive. Though this is not the case here.
---- Edit ----
Note that the POM configuration has an execution ID of enforce-java
and that execution is bound to the validate
phase of the lifecycle. The command mvn enforcer:enforce
is running a goal, not a phase in the lifecycle. The configuration you provided in the POM doesn't apply to the enforcer:enforce
goal.
There are two ways to make this work. Which one you choose depends on what you need.
mvn validate
. mvn enforcer:enforce
works, then change the execution ID to default-cli
.