How to use the mvn -D
in maven? How to set a property (or multiple properties) using it?
Are there any official articles for mvn -D
?
I couldn't find one. Thanks.
How to use the mvn -D
in maven? How to set a property (or multiple properties) using it?
Are there any official articles for mvn -D
?
I couldn't find one. Thanks.
The proper way to set a property via command-line using
-D
is:propertyName
doesn't exist in thepom.xml
, it will be set.propertyName
already exists in thepom.xml
, its value will be overwritten by the one passed as argument via-D
.To send multiple variables, use multiple space delimited
-D
s:You can check more details about properties in Maven: The Complete Reference. More specifically, in section: 6.1. Maven Command Line Options/6.1.1. Defining Properties.
Example:
If you have in your
pom.xml
:Then
mvn -Dtheme=halloween clean package
would overwritetheme
s value during this execution, having the effect as if you had: