Versions Compared

Key

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

...

Step 4: Add a new SSH key to your Github account

Step 5: Make sure your project is a Maven project or follow the migration process.

Step 6: Make sure coordinates are correct (rename packages if necessary).

Step 67: Create or edit project pom.xml with similarity content (replace on your information):

Code Block
languagexml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>your-group-id</groupId>
    <artifactId>your-artifact-id</artifactId>
    <version>your-version</version>
    <packaging>nbm</packaging>
    <name>project-name</name>
    <url>common-project-url</url>
    <description>project-description</description>
    <developers>
        <developer>
            <id>your-username</id>
            <name>your-name</name>
            <email>your-email</email>
            <url>your-common-url</url>
        </developer>
    </developers>
    <scm>
        <connection>scm:git:https://github.com/project-url.git</connection>
        <developerConnection>scm:git:https://github.com/project-url.git</developerConnection>
        <url>https://github.com/project-url/tree/${project.scm.tag}</url>
        <tag>master</tag>
    </scm>
    <licenses>
        <license>
            <name>GNU GPL 2.0</name>
            <url>https://www.gnu.org/licenses/old-licenses/gpl-2.0.html</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>
    <build>
        <plugins>
	        <plugin>
	            <groupId>org.sonatype.plugins</groupId>
            	<artifactId>nexus-staging-maven-plugin</artifactId>
            	<version>1.6.7</version>
            	<extensions>true</extensions>
            	<configuration>
                	<serverId>ossrh</serverId>
                	<nexusUrl>https://oss.sonatype.org/</nexusUrl>
                	<autoReleaseAfterClose>true</autoReleaseAfterClose>
            	</configuration>
        	</plugin>
            <plugin>
                <groupId>org.apache.netbeans.utilities</groupId>
                <artifactId>nbm-maven-plugin</artifactId>
                <version>4.3</version>
                <extensions>true</extensions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.1.2</version>
                <configuration>
                    <archive>
                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>1.6</version>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>sign</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
	<dependencies>
		<!-- Add your project dependencies! -->
	</dependencies>
</project>

Step 78Push the code to Github. 

Step 89Sign up for a Sonatype Jira account.

Step 910Create a Jira issue for new project hosting.
This triggers creation of your repositories. Normally, the process takes less than 2 business days. Why the wait?
Please do not deploy until after you have received an e-mail notice indicating that the ticket is Resolved. 
One of the most common problems related to new projects is premature deployment, which misroutes your artifacts to a catch-all repository.

Step 1011Install GNU PG or via package manager (Ubuntu example):

Code Block
languagebash
sudo apt-get install gpg

#.....

gpg --version
gpg (GnuPG) 2.2.4
libgcrypt 1.8.1
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

#......


Step 1112:
 Generate the key pair (Enter a passphrase on request):

Code Block
languagebash
gpg --full-gen-key


Step 1213:
Publish the GPG key pair and distribute your key to GPG servers:

...


Step 1314: Configuring Maven to know where to get the signing key. Modify or create <user-home>/.m2/settings.xml with content:

...


Step 14:  Do the release!


A simple way (but sometimes doing something wrong):

Code Block
languagebash
mvn clean

mvn release:prepare

mvn release:perform


Manual method (full control over the process):

First, correct the version in the version tag of your: x.x.x - public releases or x.x.x-SNAPSHOT - developer releases. With SNAPSHOT prefix you make does unlimited pushes to nexus.

Then for public releases correct tag info in the tag from scm section.

Make commit, push changes with tag into your github repository.

Then execute in project folder:

Code Block
languagebash
mvn clean install

mvn deploy


Step 16Step 15: Verify the sonatype repository.

...