简体   繁体   中英

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?

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM