Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I force Maven 2 to require a property to be specified on the command line?

Tags:

maven-2

I'm setting up a maven build, and the destination server needs to be specified on the command line as a property (which is then used to select the appropriate profile), eg

mvn -Denv=test

I'd like the build to fail if the property's not set - is that possible?

Yes, I'm a Maven newbie.

EDIT: I've seen this link, which seems to imply it's not possible, but am not sure how up to date it is.

like image 214
Hobo Avatar asked Jan 08 '09 17:01

Hobo


1 Answers

Everyone is close, but there's a rule in the enforcer to specifically check for a property, no ant or funky profiles required: http://maven.apache.org/enforcer/enforcer-rules/requireProperty.html

The rule can also check the value of the property.

like image 67
Brian Fox Avatar answered Oct 20 '22 04:10

Brian Fox