Overriding Properties
You have seen that specifying a property on the command line overrides a property defined in project.properties, and you've seen that plug-in properties are superseded by project.properties. Now that you've seen property overrides in action, take a look at how you can use property overriding to customize behavior for a specific project or a specific user.
How do I do that?
In the "Customizing Plug-in Behavior" lab earlier in this
chapter, you set the maven.axis.serverside variable in your
project.properties file. Try
running the axis:wsdl2java goal and
setting the maven.axis.serverside
property to true:
maven axis:wsdl2java -Dmaven.axis.serverside=true
If you run this, you should see Maven generating a number of
different classes and some deployment descriptors for an Apache Axis
SOAP service. By setting the maven.axis.serverside property from the
command line, you have just overridden the value specified in
project.properties. Properties
set from the command line take precedence over properties set anywhere
else in Maven.
In fact, Maven has a hierarchy of properties files which you can use to customize a build for a specific project or a specific user. Maven reads properties from the following sources, in the order shown:
- ${basedir}/project.properties
This file is a sibling to both maven.xml and project.xml. This file customizes behavior for a particular project.
- ${basedir}/build.properties
This file is also a sibling to maven.xml and project.xml, but this file ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access