In maven 2.x, how would one set a plugin's property on the command line instead of in the <configuration> of that plugin in the pom or in settings.xml?
For example, if I was using mvn dependency:copy-dependencies
(seen here) how can I set the useRepositoryLayout property without touching either the pom or my settings.xml?
Thanks!
Define the properties as arbitrary properties ... not the standard maven props such as version. In my case I defined a new property build.version:
I use the property:
I define the property:
The other answers here were not clear to me. This is the way I understand it:
If the plugin code uses a system property for its parameter, then you can define the value on the command line.
There are 3 different ways you can accomplish this in the plugin code:
If any or a combination of these methods are used in the plugin code for a particular property, then you can specify a value for the plugin parameter, on the command line. Above code was taken from maven docs here.
If you are using a plugin with the above code, you could specify a value for your property using the following command:
Usually you set maven properties using the same syntax as java system properties. Have you tried the following line?
Answer was right in front of me in the copy-dependencies mojo docs (I even linked to it). The documentation for the property includes the Expression you can refer to it by.
To set this property from command line you need to run