Patrick
Patrick

Reputation: 39

How to make Maven fail if a passed flag is invalid?

mvn install -DSkipTests

Will happily run, while running tests (as the correct capitalization is -DskipTests). I'd like to immediately know that -DSkipTests does nothing, alerting me I've made a typo. Is this possible? Why does it not work this way to start?

Upvotes: 0

Views: 117

Answers (2)

usuario
usuario

Reputation: 2467

You can use Maven Enforcer Plugin. It provides the Require Property rule which enables you to check if a property is set, and evaluate its value againsts a set of values or regular expressions.

Upvotes: 1

J Fabian Meier
J Fabian Meier

Reputation: 35805

The problem: With -D, you just specify arbitrary properties.

Maven does not know if any of your Maven plugins consumes them.

Upvotes: 1

Related Questions