Deploy sources and javadoc jars

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

  artifact-name-1.0.jar
  artifact-name-1.0-sources.jar
  artifact-name-1.0-javadoc.jar

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:3.1.1:deploy-file -Durl=file:///home/me/m2-repo \
                                                                            -DrepositoryId=some.repo.id \
                                                                            -Dfile=./path/to/artifact-name-1.0.jar \
                                                                            -DpomFile=./path/to/pom.xml \
                                                                            -Dsources=./path/to/artifact-name-1.0-sources.jar \
                                                                            -Djavadoc=./path/to/artifact-name-1.0-javadoc.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.