Forcing the user to enter a property using Maven
Question
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.
Solution
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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow