What is simple way to fail a build when a property is not set?

旧城冷巷雨未停 提交于 2019-12-08 14:52:03

问题


As stated in the title, how can I modify - in the simplest manner possible - a pom.xml in order to make it fails if a property is not set in the command line.

For example, mvn clean package will fail, when mvn clean package -Dfoo=bar will succeed.

I'm looking for something like the <prerequisites/> tag in the pom.xml (except that <prerequisites/> only allow me to check the Maven version)...


回答1:


You can use the requireProperty goal of the maven-enforcer-plugin to fail a build if a property is missing.

Note this only requires that the property is set, so it could have been set in the pom's properties section.



来源:https://stackoverflow.com/questions/1398407/what-is-simple-way-to-fail-a-build-when-a-property-is-not-set

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!