title: Gradle and src/main/resources
body: <p>I have a gradle project which is working fine within eclipse.  In the java code I have</p>
  
  <pre><code>Properties p = MyClass.class.getClassLoader.getResourceAsStream("myProps.properties");
  
  File f = new File(p.getProperty("myFile"));
  </code></pre>
  
  <p>My structure is:</p>
  
  <pre><code>src/main/java - has java files
  src/main/resources - has myProps.properties and myFile.txt
  </code></pre>
  
  <p>myProps.properties has:</p>
  
  <pre><code>myFile=src/main/resources/myFile.txt
  </code></pre>
  
  <p>If I do a gradle build (using a default shadowJar task) my resources have now been moved from src/main/resources to the root of the jar file.  </p>
  
  <pre><code>shadowJar {
     manifest{
       // The only thing I modify is the attributes
     }
  }
  </code></pre>
  
  <p>When I execute the jar by running<br>
  "java -jar myJar.jar" I get FileNotFound exception referring to the myFile.txt resource file.</p>
  
  <p>What is the correct way to fix this issue so that the code works from both  the Eclipse and executable jar environments?</p>