Installing Secondary Artifacts

Sometimes you need to install secondary artifacts after the main artifact has been installed in your local repository. To install a secondary artifact you need to use the classifier parameter to classify the secondary artifact.

Let us assume that you want to install the sources for an old artifact, like commons-logging-1.0.3. The central repository only has the main artifact and a -javadoc artifact for that version. Package up the sources into a JAR file on your local disk and then run the following command:

mvn install:install-file  -Dfile=path-to-commons-logging-sources.jar \
                          -DgroupId=commons-logging \
                          -DartifactId=commons-logging \
                          -Dversion=1.0.3 \
                          -Dpackaging=jar \
                          -Dclassifier=sources