0

My goal is to get an artifact, from maven, including all source files (also from the project dependencies).

Just something like running mvn source:jar, but with all it's dependencies also included.

Note:
- the artifact can be of any type (folder, zip, jar, etc. ...)
- I need the .java files, not the .class

How can I achieve this?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Sakul6499
  • 29
  • 1
  • 7
  • In case anyone is wondering **why**: Currently, I have to deal with a huge project, including tons of sub projects, but sadly can't change the original source. Therefore, I have to "fork" it, but meanwhile, do not want this "thousand of projects are literally **everywhere**" - Project Layout. In addition I usually do not use Maven, I need the exact dependencies also 'in-source'. – Sakul6499 Sep 08 '17 at 20:47
  • Use the Maven Shade plugin to create a fat JAR with all dependencies inside. – duffymo Sep 08 '17 at 20:49
  • Why do you need to pack it up like that, though? Maven can get sources for you. You can also build local sources and install them into your local maven repo. – pvg Sep 08 '17 at 20:49
  • Possible duplicate of [Maven – Always download sources and javadocs](https://stackoverflow.com/questions/5780758/maven-always-download-sources-and-javadocs) – Pritam Banerjee Sep 08 '17 at 20:51
  • As I said: I do want to migrate the project from maven, to gradle. Sadly the source and it's dependencies are all over the place, on different servers, different projects etc. So all in all an artifact (or folder) including the entire source would be perfect to make it a more clean project. I'll try the maven shade plugin soon. Though isn't "mvn source:jar" not already doing that? – Sakul6499 Sep 11 '17 at 13:10

0 Answers0