When your build makes use of proprietary or custom dependencies that are not available from public repositories, you will often need to find a way to make them available to developers in a custom Maven repository. Nexus ships with a preconfigured third-party repository that was designed to hold third-party dependencies that are used in your builds. To upload artifacts to a repository, select a hosted repository in the Repositories panel and then click on the Artifact Upload tab. Clicking on the Artifact Upload tab will display the tab shown in Figure 5.28, “Artifact Upload Tab”.
To upload an artifact, click on Select Artifact(s) to Upload…, and select one or more artifacts from the filesystem to upload. Once you have selected an artifact, you can modify the classifier and the extension before clicking on the Add Artifact button. Once you have clicked on the Add Artifact button, you can then configure the source of the Group, Artifact, Version (GAV) parameters.
If the artifact you are uploading is a jar file that was created by Maven it will already have POM information embedded in it. If you are uploading a jar from a vendor you will likely need to set the group identifier, artifact identifier, and version manually. To do this, select GAV Parameters from the GAV Definition drop-down at the top of this form. This will expose a set of form fields which will let you set the Group, Artifact, Version, and Packaging of the artifacts being uploaded. Packaging can be selected from the list or provided by typing the value into the input box.
If you would prefer to set the group, artifact, and version from a POM file associated with the uploaded artifact, select From POM in the GAV Definition drop-down. This will expose a button labeled Select POM to Upload. Once a POM file has been selected for upload, the name of the POM file will be displayed in the form field below this button.
Uploading a POM file allows you to add further details like dependencies to the file, which improves the quality of the upload by enabling transitive dependency management.
The Artifact Upload panel supports multiple artifacts with the same group, artifact, and version identifiers. For example, if you need to upload multiple artifacts with different classifiers, you may do so by clicking on Select Artifact(s) for Upload and Add Artifact multiple times. A common use case for this upload is to upload the pom and jar file as well as the javadoc and sources jar files file for an artifact.