In my Maven project there is one module (core) that has a few resources for its classes. When running classes inside the module its able to get its own resources. Everything works fine.
Where stuff breaks is when another module which depends on the core tries to run that class. The folder that Java is looking for resources in is this module, not the core module. So the class fails.
In short: How can I access the resources of a dependency?
I've experimented with trying to do this by declaring in Core's JAR Manifest Class-Path: .
. However when listing the resources available with JSHookLoader.class.getClassLoader().getResources("");
(JSHookLoader is in Core if it means anything), I get:
Resource: W:\programming\quackbot-hg\impl\target\classes
File rebel.xml
Resource: W:\programming\maven-repo\org\quackbot\core\3.5-SNAPSHOT
File core-3.5-SNAPSHOT.jar
File core-3.5-SNAPSHOT.pom
File maven-metadata-local.xml
File _maven.repositories
This of course complicates things as I expected the JAR itself to be in the Classpath, not the directory the JAR is in
Any suggestions?
Coming back to this project I still have this issue. Other guides have talked about using maven-assembly-plugin and the remote resources plugin, but thats a lot of pain as all modules have to include the monster plugin XML.
Why don't I simplify the question to this: How can I add a dependencies JAR to the resource list?
- core.jar has some resources in it under the folder /resources. Running core.jar I can see /resources in the resource list.
- impl.jar depends on core.jar. Upon running it though /resources isn't in the resource list and therefore causes havoc.
This should be simple enough, but how can I do it? I've spend hours trying to figure out a simple clean way to do it but to no avail.