I need to somehow find the classpath for maven, i.e. all dependencies, etc... and use it as part of the configuration for a plugin. Here is an example
...<systemProperties>
<systemProperty>
<name>some.system.property.here</name>
<value>${maven.runtime.classpath}</value>
</systemProperty>
</systemProperties>
</configuration>...
Unfortunately property ${maven.runtime.classpath} is empty. Is there anything that is the equivalent of this?
The easiest thing to do is to use something like groovy and set it up programatically.
Here is the config that needs to be included.
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<configuration>
<source>
import org.codehaus.plexus.util.StringUtils;
import java.io.File;
System.setProperty("your.classpath.property", StringUtils.join(project.getRuntimeClasspathElements().iterator(), File.pathSeparator));
</source>
</configuration>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>execute</goal>
</goals>
</execution>
</executions>
</plugin>
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