2

The Maven goal dependency:copy-dependencies copies artifacts together with their poms (if the parameter is set). Is it somehow possible to also grab sources and javadoc?

Tunaki
  • 132,869
  • 46
  • 340
  • 423
J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142

2 Answers2

3

You won't be able to copy the dependencies, along with their sources and their javadoc in a single pass, but you can use classifier parameter and multiple invocation of the Dependency Plugin:

Specify classifier to look for. Example: sources

For example, if you want to copy all the dependencies with their sources and javadoc, you could have:

mvn clean dependency:copy-dependencies
mvn dependency:copy-dependencies -Dclassifier=sources
mvn dependency:copy-dependencies -Dclassifier=javadoc

Running the 3 commands above on a sample Maven project will copy its dependencies, their sources and javadoc inside the default output directory which is target/dependency. Notice that it doesn't clean, in order not to delete the previously copied files.

This could also be done inside of the POM, with 3 execution blocks.

Tunaki
  • 132,869
  • 46
  • 340
  • 423
0

We can use below maven command:

mvn install dependency:sources -Dclassifier=javadoc

027
  • 1,553
  • 13
  • 23