I would like to add a dependency to my maven project so that Maven can resolve the dependency, but not add it to the classpath. E.g.
<dependency>
<groupId>com.example</groupId>
<artifactId>example-artifact</artifactId>
<type>bin</type>
<classifier>jar-with-dependencies</classifier>
<version>1.0</version>
</dependency>
In this particular case, the dependency is a FAT executable jar file, that I want to run from my Mojo. I don't want the contents of that jar file to pollute my mojo's classpath. I just want it treated as a binary file, so that I can look it up inside my mojo (via project.getArtifacts()
, and then execute it as CLI.
I've tried both "zip" and "bin" packaging types, but it always seems to end up on the classpath.
I could bundle the zip inside another jar dependency and then extract/run it at runtime, but I would prefer to just figure out how to resolve it but exclude it from the classpath.
Any ideas?