Skip to content

How To Publish To Nexus

craig jackson edited this page Oct 10, 2015 · 6 revisions

Overview

This page describes how to setup your dev environment to publish an artifact to http://oss.sonatype.org/.

One Off Activities

Create A Sonatype Account

Sign up for a sonatype JIRA account

Create And Publish GPG key

First, create the key:

gpg --gen-key

Now list the public key:

gpg --list-keys|grep ^pub

The output will include the text "key" followed by the key length, a slash and the key itself.

Finally, send the key to a keyserver

gpg --keyserver hkp://pgp.mit.edu --send-keys "__your_key_here__"

Update $M2_HOME/settings.xml

<servers>
    <server>
        <id>sonatype-nexus-snapshots</id>
        <username>__your_sonatype_login__</username>
        <password>__your_sonatype_password__</password>
    </server>
    <server>
         <id>sonatype-nexus-staging</id>
        <username>__your_sonatype_login_here__</username>
        <password>__your_sonatype_password_here__</password>
    </server>
</servers>
<profiles>
    <profile>
        <id>sign</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
            <gpg.passphrase>__your_gpg_passphrase_here__</gpg.passphrase>
        </properties>
    </profile>
</profiles>

Per-Release Activities

Prepare The Release

mvn -Dresume=false -Dgpg.passphrase="__your_pgp_passphrase_here__" clean release:prepare

Upload To Nexus

Note: Ensure the pom.xml version is NOT postfixed with "-SNAPSHOT".

mvn -Dgpg.passphrase="__your_pgp_passphrase_here__" clean deploy -P release-sign-artifacts

Close The Release In Nexus

  • Login to https//oss.sonatype.org/
  • Select Staging Repositories
  • Scroll down the repository list to find a repository called "netsourceforgejavaflacencoder"
  • Select that repository and click the "Close" button

References