title: How to read file from file system during Maven build of module
body: <p>I have a Maven project A (packaged as a pom) containing Maven module project B (packaged as a jar). 
  Project B is also physically in the root of project A. </p>
  
  <p>When B is being built, a plugin indirectly uses my code (inside B) to access a property file in its src/main/resources location. </p>
  
  <p>When I build project B directly (mvn clean install) the code can easily find that file by using <code>new File("src/main/resources/foo.properties");</code> </p>
  
  <p>However when I try to build project A, it first will try to build the module B, and in that case it cannot find the property file. </p>
  
  <p>Apart from the 'new File' variant, I have tried using
  <code>this.getClass().getClassLoader().getResourceAsStream("src/main/resources/foo.properties");</code></p>
  
  <p>and I tried using Spring:</p>
  
  <p><code>Resource resource = new ClassPathResource("src/main/resources/foo.properties");</code></p>
  
  <p>Both also with a "/" prefix. But the file simply cannot be found. </p>
  
  <p>Why is that? Might it be looking for the file in the root of A? Is it possible to find the file in module B when building A?</p>
  
  <p>Thanks!</p>