You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Step 1: Make sure if you have installed JDK, Maven, Github, etc.

Step 2: Create a Github account if you haven't already.

Step 3: Create a new Github repository.

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

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

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

<?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>
    <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>
</project>

Step 7: Push the code to Github. 

Step 8: Sign up for a Sonatype Jira account.

Step 9: Create 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 10: Install GNU PG or via package manager (Ubuntu example):

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 11:
 Generate the key pair (Enter a passphrase on request):

gpg --full-gen-key


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

gpg --list-keys

gpg –keyserver [KEY_SERVER] –send-key [KEY_ID]

Some of the key servers are: 


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

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                          https://maven.apache.org/xsd/settings-1.0.0.xsd">
        <localRepository/>
        <interactiveMode/>
        <offline/>
        <pluginGroups/>
        <servers>
            <server>
                <id>ossrh</id>
                <username>your-jira-id</username>
                <password>your-jira-pwd</password>
            </server>
        </servers>
        <mirrors/>
        <proxies/>
        <profiles>
            <profile>
                <id>ossrh</id>
                <activation>
                    <activeByDefault>true</activeByDefault>
                </activation>
                <properties>
                    <gpg.passphrase>passphrase-you-used-when-created-gpg-key</gpg.passphrase>
                </properties>
            </profile>
        </profiles>
        <activeProfiles/>
</settings>


Step 14:  Do the release!

mvn clean

mvn release:prepare

mvn release:perform


Step 15: Verify the sonatype repository.

https://oss.sonatype.org/#nexus-search;quick~your-group-id


What's next?

Knowing your groupId and artifactId pair consider registering
your plugin in Apache NetBeans Plugin Portal using this instruction.


  • No labels