Details
-
Type:
New Feature
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.1.1
-
Fix Version/s: None
-
Component/s: exec
-
Labels:None
-
Number of attachments :
Description
Was suggested to file a feature request and then possibly contribute instead of creating a new plugin.
The original request is described here: http://n2.nabble.com/resolve-jar-path-by-specifying-dependency-with-a-property-td2494162.html#a2494162
Feature basically is about referencing a dependency specified in the same pom where the maven exec plugin is used.
So, a dependency like:
<dependency>
<groupId>net.whatever.domain</groupId>
<artifactId>mydep</artifactId>
<version>1.4</version>
<scope>test</scope>
</dependency>
could be referenced in an exec plugin's argument list in the same pom by something like:
<argument>-Xbootclasspath/a:
{project.dependencies.dependency.mydep.jar}</argument><argument>-javaagent:{project.dependencies.dependency.mydep.jar}
</argument>
It would be a handy addition, because this way you would not need to hardcode paths in the pom.
Not sure what the ideal notation could be:i am using curly brackets in my example.
In my simplistic first crack at it (attached), i am basically editing ExecMojo.execute() method. In ExecMojo i am adding a method (String findJarDep(String identifier)) that parses the identifier and then uses Artifact to return the path to the jar adding it to the commandArguments list.
Obviously i would like to hear from someone if this addition would make sense, suggestions etc, before i start making it better with correct exception handling, tests, etc (did that i few minutes as a first draft to get the idea).
Sounds like a cool idea to me! Any opportunity to reduce hard coding is a good thing.