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!
Maven is a command-line tool for building Java (and other) programs. The Maven project provides a simple ZIP file containing a precompiled version of Maven for your convenience. There is no installer. It's up to you to set up your prerequisites and environment to run Maven on Windows.
-D, --define <arg> Defines a system property. This is the option most frequently used to customized the behavior of Maven plugins. Some examples of using the -D command line argument: $ mvn help:describe -Dcmd=compiler:compile $ mvn install -Dmaven.test.skip=true.
A reference tells us that -P specifies which profile Maven is to run under. Projects can define multiple profiles which may pull in different dependencies, so this is required if you have a project that can do that.
Build plugins They execute during the build process and should be configured in the <build/> element of pom. xml.
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.
useRepositoryLayout: Place each artifact in the same directory layout as a default repository. example: /outputDirectory/junit/junit/3.8.1/junit-3.8.1.jar
* Type: boolean * Since: 2.0-alpha-2 * Required: No * Expression: ${mdep.useRepositoryLayout} * Default: false
To set this property from command line you need to run
mvn -Dmdep.useRepositoryLayout=true <goals go here>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With