title: Access files within resource directory in maven generated jar
body: <p>I've done my research, but I just really can't get it to work.
  I'm using Spring Boot with Maven. Thymeleaf and jquery for my frontend.</p>
  
  <p>My directory:</p>
  
  <pre><code>project-system/
  ├── mvnw
  ├── mvnw.cmd
  ├── pom.xml
  ├── src
  │   ├── main
  │   │   ├── java
  │   │   │   └── rigor
  │   │   │       └── io
  │   │   │           └── projectsystem
  │   │   │               ├── rush
  │   │   │               │   ├── TemporaryController.java
  │   │   │               └── ProjectSystemApplication.java
  │   │   └── resources
  │   │       ├── application.properties
  │   │       ├── MOCK_DATA.json
  │   │       ├── static
  │   │       └── templates
  │   │           ├── index.html
  │   │           └── records.html
  </code></pre>
  
  <p>Inside <code>TemporaryController</code>, I'm doing this operation:</p>
  
  <pre><code>list = new ObjectMapper().readValue(new File("./src/main/resources/MOCK_DATA.json"), new TypeReference&lt;List&lt;POJO&gt;&gt;() {});
  </code></pre>
  
  <p>So with this, I'm able to access the <code>MOCK_DATA.json</code> under the <code>resources</code> directory.</p>
  
  <p>But now, I want to package it into a jar. This is proving a bit troublesome for me. Here's my build in my <code>pom</code> file:</p>
  
  <pre><code>&lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt;
              &lt;version&gt;2.6&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;id&gt;copy-resources&lt;/id&gt;
                      &lt;phase&gt;validate&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;copy-resources&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;outputDirectory&gt;${basedir}/target/classes/src/main&lt;/outputDirectory&gt;
                          &lt;includeEmptyDirs&gt;true&lt;/includeEmptyDirs&gt;
                          &lt;resources&gt;
                              &lt;resource&gt;
                                  &lt;directory&gt;${basedir}/src/main/&lt;/directory&gt;
                                  &lt;filtering&gt;false&lt;/filtering&gt;
                              &lt;/resource&gt;
                          &lt;/resources&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
  
          &lt;plugin&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
              &lt;configuration&gt;
                  &lt;archive&gt;
                      &lt;manifest&gt;
                          &lt;addClasspath&gt;true&lt;/addClasspath&gt;
                          &lt;classpathPrefix&gt;lib/&lt;/classpathPrefix&gt;
                          &lt;mainClass&gt;rigor.io.projectsystem.ProjectSystemApplication&lt;/mainClass&gt;
                      &lt;/manifest&gt;
                  &lt;/archive&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p>And the resulting <code>target</code> directory this gives me is:</p>
  
  <pre><code>├── target
  │   ├── classes
  │   │   ├── application.properties
  │   │   ├── MOCK_DATA.json
  │   │   ├── rigor
  │   │   │   └── io
  │   │   │       └── projectsystem
  │   │   │           ├── rush
  │   │   │           │   ├── TemporaryController.class
  │   │   │           └── ProjectSystemApplication.class
  │   │   ├── src
  │   │   │   └── main
  │   │   │       ├── java
  │   │   │       │   └── rigor
  │   │   │       │       └── io
  │   │   │       │           └── projectsystem
  │   │   │       │               ├── rush
  │   │   │       │               │   ├── TemporaryController.java
  │   │   │       │               └── ProjectSystemApplication.java
  │   │   │       └── resources
  │   │   │           ├── application.properties
  │   │   │           ├── MOCK_DATA.json
  │   │   │           ├── static
  │   │   │           └── templates
  │   │   │               ├── index.html
  │   │   │               └── records.html
  │   │   └── templates
  │   │       ├── index.html
  │   │       └── records.html
  │   ├── generated-sources
  │   │   └── annotations
  │   ├── generated-test-sources
  │   │   └── test-annotations
  │   ├── maven-archiver
  │   │   └── pom.properties
  │   ├── maven-status
  │   │   └── maven-compiler-plugin
  │   │       ├── compile
  │   │       │   └── default-compile
  │   │       │       ├── createdFiles.lst
  │   │       │       └── inputFiles.lst
  │   │       └── testCompile
  │   │           └── default-testCompile
  │   │               ├── createdFiles.lst
  │   │               └── inputFiles.lst
  │   ├── surefire-reports
  │   │   ├── rigor.io.projectsystem.ProjectSystemApplicationTests.txt
  │   │   └── TEST-rigor.io.projectsystem.ProjectSystemApplicationTests.xml
  │   ├── test-classes
  │   │   └── rigor
  │   │       └── io
  │   │           └── projectsystem
  │   │               ├── ProjectSystemApplicationTests$1.class
  │   │               └── ProjectSystemApplicationTests.class
  │   ├── project-system-0.0.1-SNAPSHOT.jar
  │   └── project-system-0.0.1-SNAPSHOT.jar.original
  </code></pre>
  
  <p>As you can see, there are some redundancies that are happening, and when I try to run the jar file, it gives me a <code>java.io.FileNotFoundException: ./src/main/resourfces/MOCK_DATA.json (No such file or directory)</code></p>