Forcing the user to enter a property using Maven

我怕爱的太早我们不能终老 提交于 2019-12-11 04:34:47

问题


What I want to do is this: I have a pom.xml that depends on some property that the user will have to type as he calls mvn by an -D property.

The problem is, if the user don't give me this option, the mvn should fail with an custom error message, as "This program won't compile because you must define this property..."

Does anyone know what's the simplest way to make this happen? I don't want to create a plugin that throws an Exception just to do this.


回答1:


The Maven Enforcer Plugin already has a rule to require a property. You can specify a error message and even check the value with an regex.

Enforcer Rules - Require Property



来源:https://stackoverflow.com/questions/1059468/forcing-the-user-to-enter-a-property-using-maven

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