问题
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