I'm using the maven-assembly-plugin to generate a single jar file with all dependencies using the command line:
mvn clean compile assembly:single
It compile all .java files from the directory src/main/java/ to a .jar file in target/.
I have a class inside of my src/main/java/ directory that read a .json file which is located next to him using this code:
File file = new File("src/main/java/path/to/test.json");
content = FileUtils.readFileToString(file, "UTF-8");
So I will need to have access to this .json file in my generated .jar.
I include this .json in maven using this config in <build>:
<resources>
    <resource>
        <directory>src/main/java</directory>
        <includes>
            <include>src/main/java/path/to/test.json</include>
        </includes>
    </resource>
</resources>
Everything compile successfully and when I tried to run my .jar file in target/ directory using java -jar ./target/my-jar-file.jar it's work great.
Problem is that now I want to be able to move my .jar file wherever I want. But when I execute it in another place I get the error message:
java.io.FileNotFoundException: File 'src/main/java/path/to/test.json' does not exist
So obviously the .json file has not been included in my generated .jar. 
Has somebody an idea what I have missed ?
 
     
    