title: Use a dependency's resources?
body: <p>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.</p>
  
  <p>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.</p>
  
  <p>In short: How can I access the resources of a dependency?</p>
  
  <hr>
  
  <p>I've experimented with trying to do this by declaring in Core's JAR Manifest <code>Class-Path: .</code>. However when listing the resources available with <code>JSHookLoader.class.getClassLoader().getResources("");</code> (JSHookLoader is in Core if it means anything), I get:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>This of course complicates things as I expected the JAR itself to be in the Classpath, not the directory the JAR is in</p>
  
  <p>Any suggestions?</p>
  
  <hr>
  
  <p>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. </p>
  
  <p>Why don't I simplify the question to this: How can I add a dependencies JAR to the resource list? </p>
  
  <ol>
  <li>core.jar has some resources in it under the folder /resources. Running core.jar I can see /resources in the resource list.</li>
  <li>impl.jar depends on core.jar. Upon running it though /resources isn't in the resource list and therefore causes havoc.</li>
  </ol>
  
  <p>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.</p>