Skip to main content

Uploading Components in Nexus Repository 2

Nexus Repository 2

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 Repository Manager Pro and Nexus Repository Manager OSS ship with a preconfigured third-party repository that was designed to hold third-party dependencies that are used in your builds. To upload components to a repository, select a hosted repository in the Repositories panel and then click on the Artifact Upload tab, which will display the tab shown in Figure 5.27, “Component Upload Tab”.

5411463.png

Figure 5.27. Component Upload Tab

To upload a component, click on Select Artifact(s) to Upload…, and select one or more components from the filesystem to upload. Once you have selected a component, you can modify the classifier and the extension before clicking on the Add Artifact button. Then you can then configure the source of the Group, Artifact, Version (GAV) parameters.

If the component 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, component 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 components 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, component, and version from a POM file associated with the uploaded component, 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.

Note

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 components with the same group, component, and version identifiers. For example, if you need to upload multiple components 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 a component.