Have searched for hours to resolve something that initially seemed to be an
easy issue…
Question is: can I somehow get hold of the path to a jar of a dependency
specified in my pom while running a plugin like mvn exec:exec also
specified in my pom?
In my pom.xml I have various dependencies, one of which is something like,
as usual:
<dependency>
<groupId>net.whatever.domain</groupId>
<artifactId>mydep</artifactId>
<version>1.4</version>
<scope>test</scope>
</dependency>
which is a jar called, say, mydep.jar.
In this pom.xml I want to use the exec plugin to run a java application.
I configure the exec plugin with <classpath/>, main class, scope, other
arguments, I run it from the command line with mvn exec:exec and it is all
good.
However, if I want to pass to exec two more arguments as java options, like
this:
<argument>-Xbootclasspath/a:path/to/mydep.jar</argument>
<argument>-javaagent: path/to/mydep.jar </argument>
then how do i do that without hardcoding the path?
Ideally, I would like to do something similar to (similarly to what you do
for project name for instance, like ${project.name}):
<argument>-Xbootclasspath/a:${project.dependencies.dependency.mydep.jar}</argument>
<argument>-javaagent:${project.dependencies.dependency.mydep.jar}</argument>
Is this possible to do somehow or do I have to modify the exec mojo for
getting hold of the wanted dependency?
I searched quite a bit to find this out and looks like I have to create my
mojo for it, but wanted to make sure first.
Max
--
Max Calderoni
Senior Java GUI Engineer
SenSage, Inc.
[email protected]
--
Max Calderoni