views:

55

answers:

1

Hello all,

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.

+4  A: 

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

jitter