tags:

views:

136

answers:

1

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)...

+3  A: 

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.

Rich Seller
Yes, for one property in my project, I've set a default value, which can be overriden by the user. However, I really need that the user specifies another property, so that's why I wanted to find a way to fail the build if the user forgot this propery.
romaintaz