Deploy sources and javadoc jars

A project may include a main jar and associated sources and javadoc jars.


The sources jar contains the Java sources, and the javadoc jar contains the generated javadocs. To include these files in your deployment, set the sources and javadoc parameters to the paths to the sources and javadoc jar files.

mvn org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy-file -Durl=file:///home/me/m2-repo \
                                                                            -Dfile=./path/to/artifact-name-1.0.jar \
                                                                            -DpomFile=./path/to/pom.xml \
                                                                            -Dsources=./path/to/artifact-name-1.0-sources.jar \

Note: By using the fully qualified path of a goal, you're ensured to be using the preferred version of the maven-deploy-plugin. When using mvn deploy:deploy-file its version depends on its specification in the pom or the version of Apache Maven.