I know how to create a JAR file with the source code with maven, and also create an executable JAR. But my question is if there is any way of creating an executable JAR (so it contains all the .class files) that also contains the source code (so for each .class its corresponding .java file).
I want this for debugging with eclipse since my maven project is a library for another project and when debugging the bigger project I loose track when the execution reaches my library because the source code is missing in the JAR. I’ve found a solution among this forums that suggests to create two jars, one executable and another with .java files and set the source path in the IDE to point to the code JAR, but I would like to work with a unique JAR instead of two. Is that possible? if not with maven with another java tool? For instance merging both JAR files?
Lots of thanks.
You can declare your source directory as additinal resource directory
This will place the java files next to the class files – I do not know if your IDE supports debugging with this structure. Usually @Brian Agnew suggested way is the way to go.