How to copy both a jar and its source jar to a specific folder in one command?
09:28 17 Oct 2026

I am trying to copy a jar and its source jar into a specific folder without needing to do 2 runs of the same command.

I am well aware of mvn dependency:copy-dependencies, which does a good job of copying the jar file to the ./target/dependency/ folder, which is great.

I am also aware of mvn dependency:copy-dependencies -Dclassifier=sources, which does the same, but for source files.

But how do I accomplish both in a single command?

The best that I have been able to manage has been to run each in a separate run, which is not ideal.

I have also explored some of the commandline options for that plugin. Namely, the -Dclassifier, the -DincludeClassifiers, -Dtypes, and -DincludeTypes, all to no avail.

maven dependency-management maven-dependency-plugin