Reputation: 12922
I have a Maven project that is runnable from the command line, and I was planning to use mvn exec:java
to run it from some scripts. That project can interface with other different projects in a plugin-type architecture, so I'd like to specify which plugin to load on the command line. The plugins are developed independently from core code, so I'd like to avoid referencing them in the core project's pom if at all possible.
It seems like executableDependency
from the exec
Maven plugin's configuration may be what I'm looking for, but it doesn't look like I can specify that on the command line.
Upvotes: 4
Views: 125
Reputation: 135762
I came across a somewhat similar problem (not in the context of plugins, though) once and I don't believe that's possible.
I did have to find a quick solution back then, and used properties in the pom.xml
:
<dependency>
<groupId>${mygid}</groupId>
<artifactId>${myaid}</artifactId>
<version>${myver}</version>
</dependency>
And would run it like:
mvn -Dmygid=junit -Dmyaid=junit -Dmyver=4.11 clean package
Upvotes: 2
Reputation: 15628
You can perhaps use Maven profiles. Use different profiles for different use cases and activate the profile command line. A profile can contain dependencies and plugins which will only be used if that profile is activated.
Upvotes: 2