Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Add Credentials to settings.xml

NOTE: Below I use OSSRH as an example, but this should work for any repository.

Plug your Nexus credentials into the <servers> block of your settings.xml file.

...

NOTE: Below I use OSSRH as an example, but this should work for an any repository.

You can use a syntax similar to that of install-file to deploy a single artifact to a remote Nexus repo:

...

  • SNAPSHOTs will overwrite each other... I still haven't figured out how to deploy a full set of SNAPSHOT artifacts. Maybe manually bundling them up before calling deploy-file?
  • Deployment of SNAPSHOT artifacts to a staging server will result in failure (HTTP 400: Bad Request). Your artifacts must not end with SNAPSHOT to successfully deploy to staging.
  • Similarly, deploying non-SNAPSHOT artifacts to a snapshot server will also fail with HTTP 400: Bad Request.

Configuring

...

Upstream POMs for Deployment

NOTE: Below I use OSSRH as an example, but this should work for an any repository.

Once your project ticket has been approved, you can add the following block to your project's pom.xml file:

...

You should now be able to deploy to the above repositories by running the following command:

Code Block
languagebash
$ mvn deploy

Central Sync Requirements

OSSRH (and probably other approved repository hosts) will even sync your released artifacts with Maven Central on your behalf.

Configuring Downstream POMs for Consumption

NOTE: Below I use OSSRH as an example, but this should work for any repository.

Now that you've deployed your first SNAPSHOT, you should be able to download the SNAPSHOT artifacts for consumption during development/testing.

Add the following section to your root POM to automatically inherit the necessary configuration from OSSRH:

Code Block
languagebash
<project>
    <!-- the rest of your POM -->


    <parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>7</version>
    </parent>


    <!-- the rest of your POM -->
</project>

NOTE: This <parent> can also be another module whose <parent> is OSSRH, and this should still work

You should now be able to pull SNAPSHOT artifacts for OSSRH projects when building using the usual command:

Code Block
languagebash
$ mvn clean package

Central Sync Requirements

NOTE: Below I use OSSRH as an example, but this should work for any Accepted Hosting Repository.

OSSRH (and probably other approved repository hosts) will even sync your released artifacts with Maven Central on your behalf.

Sadly, this process did Sadly, this process did not seem to lift any of the strictorequirements strict requirements for the artifacts synced/

...