简体   繁体   English

如果传递的标志无效,如何使 Maven 失败?

[英]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 ).将愉快地运行,同时运行测试(因为正确的大写是-DskipTests )。 I'd like to immediately know that -DSkipTests does nothing, alerting me I've made a typo.我想立即知道-DSkipTests什么都不做,提醒我我打错了字。 Is this possible?这可能吗? Why does it not work this way to start?为什么不能以这种方式开始?

The problem: With -D , you just specify arbitrary properties.问题:使用-D ,您只需指定任意属性。

Maven does not know if any of your Maven plugins consumes them. Maven 不知道您的 Maven 插件是否使用它们。

You can use Maven Enforcer Plugin .您可以使用Maven Enforcer 插件 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.它提供了Require Property 规则,使您能够检查是否设置了属性,并根据一组值或正则表达式评估其值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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