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 your project is a Maven project or follow the migration process.

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

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

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">
            <name>GNU GPL 2.0</name>
		<!-- Add your project dependencies! -->

Step 8: Push the code to Github. 

Step 9: Sign up for a Sonatype Jira account.

Step 10: 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 11: 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 <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.


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

gpg --full-gen-key

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

<settings xmlns=""

Step 14:  Do the release!

A simple way (but sometimes doing something wrong):

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:

mvn clean install

mvn deploy

Step 16: Verify the sonatype repository.;quick~your-group-id

For Ant project plugins

You can also deploy your plugin to the Maven Central Repository without converting it to a Maven project.

First of all, please do the same steps as above until step 14 except step5.

Step 15: Add the Maven Ant Tasks to the lib directory.

e.g. yourproject/lib/maven-ant-tasks-2.1.3.jar

Step 16: Modify the build.xml

Please don't forget to add " xmlns:artifact="antlib:org.apache.maven.artifact.ant" to the project tag.

Please change the following:

  • your-group-id
  • your-artifact-id
  • your-version
  • your-code-name-base(changed dots to hyphens)

Note: You have to set the same version as build.xml to the and pom.xml.

<?xml version="1.0" encoding="UTF-8"?>
<project name="your-code-name-base" default="netbeans" basedir="." xmlns:artifact="antlib:org.apache.maven.artifact.ant">
    <description>Builds, tests, and runs the project .</description>
    <import file="nbproject/build-impl.xml"/>

    <path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.3.jar" />
    <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="antlib:org.apache.maven.artifact.ant" classpathref="maven-ant-tasks.classpath" />

    <!-- define Maven coordinates -->
    <property name="build" value="build" />
    <property name="groupId" value="your-group-id" />
    <property name="artifactId" value="your-artifact-id" />
    <!-- don't forget change the versions of pom.xml and -->
    <property name="version" value="your-version" />
    <!-- defined maven snapshots and staging repository id and url -->
    <property name="ossrh-snapshots-repository-url"
              value="" />
    <property name="ossrh-staging-repository-url"
              value="" />
    <!-- there server id in the Maven settings.xml -->
    <property name="ossrh-server-id" value="ossrh" />
    <property name="code-name-base" value="your-code-name-base(changed dots to hyphens)" />
    <property name="nbm-path" value="${build}/${artifactId}-${version}" />

    <!-- Need close and release on after the nbm is uploaded -->
    <target name="deploy" depends="clean,nbm" description="deploy release version to Maven repository">
        <move file="${build}/${code-name-base}.nbm" toFile="${nbm-path}.nbm"/>
            <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
            <arg value="-Durl=${ossrh-staging-repository-url}" />
            <arg value="-DrepositoryId=${ossrh-server-id}" />
            <arg value="-DpomFile=pom.xml" />
            <arg value="-Dfile=${nbm-path}.nbm" />
            <arg value="-Pgpg" />

Step 17: Modify .gitignore

Add the following:


Step 18: Deploy to the Maven repository

cd /path/to/your/project
ant deploy
     [move] Moving 1 file to /path/to/build
[artifact:mvn] [INFO] Scanning for projects...
[artifact:mvn] [INFO] ------------------------------------------------------------------------
[artifact:mvn] [INFO] Building 
[artifact:mvn] [INFO]    task-segment: [org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file] (aggregator-style)
[artifact:mvn] [INFO] ------------------------------------------------------------------------
[artifact:mvn] [INFO] [gpg:sign-and-deploy-file]
[artifact:mvn] gpg: *警告*: "--no-use-agent"は、使われなくなったオプションです - なんの効果もありません
[artifact:mvn] gpg: *警告*: "--no-use-agent"は、使われなくなったオプションです - なんの効果もありません
[artifact:mvn] Uploading:<version-number>/your-artifactId-<version-number>.nbm
[artifact:mvn] 640K uploaded
[artifact:mvn] [INFO] Retrieving previous metadata from ossrh
[artifact:mvn] [INFO] repository metadata for: 'artifact your-groupId:your-artifactId' could not be found on repository: ossrh, so will be created
[artifact:mvn] [INFO] Uploading repository metadata for: 'artifact your-groupId:your-artifactId'
[artifact:mvn] [INFO] Uploading project information for your-artifactId <version-number>
[artifact:mvn] [INFO] Uploading your-artifactId-<version-number>.pom.asc
[artifact:mvn] [INFO] Uploading your-artifactId-<version-number>.nbm.asc
[artifact:mvn] [INFO] Metadata[artifact your-groupId:your-artifactId].filename = maven-metadata.xml
[artifact:mvn] [INFO] Metadata[project your-groupId:your-artifactId].filename = your-artifactId-<version-number>.pom
[artifact:mvn] [INFO] Metadata[gpg signature your-groupId:your-artifactId:nbm:null:pom].filename = your-artifactId-<version-number>.pom.asc
[artifact:mvn] [INFO] Metadata[gpg signature your-groupId:your-artifactId:nbm:null].filename = your-artifactId-<version-number>.nbm.asc
[artifact:mvn] [INFO] ------------------------------------------------------------------------
[artifact:mvn] [INFO] BUILD SUCCESSFUL
[artifact:mvn] [INFO] ------------------------------------------------------------------------
[artifact:mvn] [INFO] Total time: 42 seconds
[artifact:mvn] [INFO] Finished at: Mon Jun 22 07:06:51 JST 2020
[artifact:mvn] [INFO] Final Memory: 27M/604M
[artifact:mvn] [INFO] ------------------------------------------------------------------------

Total time: 44 seconds

Step 19: Close and release on

Also, see the following:

What's next?

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

  • No labels


  1. Can some kind volunteer please move the Ant to Maven migration procedure from legacy to this NetBeans Confluence space?

    1. The legacy wiki was already migrated to the new apache website. Should we fix the content there if we have to do it?

      1. Oh yes, great. I have updated the link in this Confluence page to that new location. Thanks for the reminder.

  2. We may be carefull for the ant parts, the plugin used to the process is deprecated, I'm not sure how the replacement plugin is working

    1. I also noticed that. I used Maven Ant Task because it is used in the official document yet. I didn't try Maven Artifact Resolver Ant Tasks... It would be nice if someone tries it.