Software Developer at Sonatype, primarly focused on Nexus Development. Been doing java dev for ~7 years, and C++ for ~4 years prior to that Damian is a DZone MVB and is not an employee of DZone and has posted 1 posts at DZone. You can read more from them at their website. View Full User Profile

Writing a Nexus Plugin Using m2eclipse

  • submit to reddit

In this post, I’m going to walk you through the process of creating a new Nexus plugin using the m2eclipse plugin for eclipse from start to finish including all steps in the process.  After reading this post you will know about the easiest way to get started working on your own Nexus plugin.

Some things to note are that I am using the latest m2e 0.9.9 dev build available from the update site. I am also using eclipse 3.5.1.  All maven builds have been done using local build of latest maven 3.0-SNAPSHOT, however, that is not a requirement for the plugins to work, just a recommendation as maven 3 (in my opinion) is much better than maven 2 :)

Configuring Your Environment for the Nexus Plugin Project

To successfully create a Nexus Plugin using the Nexus Plugin archetype, you will need to configure your Maven Settings to include both the Sonatype Forge repository and the Central Maven repository. If you are already using Nexus and you have configured your settings.xml to use a single, consolidated repository group, all you need to do is add a proxy repository for the Sonatype Forge repository to your repository group. If you are not using Nexus, you will need to use a settings.xml that resembles the following sample:


Creating a New Project with the Nexus Plugin Archetype

Let’s start by creating a ‘New Maven Project’ in m2eclipse.


Select Maven > Maven Project, and click on Next until you reach the archetype selection. On this screen you can search for and select the archetype which will create your new project. Note that you must use the 1.2 version of the nexus-plugin-archetype.


Enter the GAV (groupId, artifactId, version) params that will uniquely define the plugin, and click on Next.

Targeting the Proper Nexus Version

After supplying the project identifiers, you will see a panel that display the archetype property ${nexusVersion}. This is the version of Nexus that your plugin will target and it will associate your project with the proper set of dependencies for a specific version of Nexus.


By default the nexus-plugin-archetype will target Nexus version 1.4.1.   If you are targeting 1.4.1, it is important that you add the following to your project’s dependency management because of a problem w/ the parent POM of Nexus 1.4.1. If you are not tied to using Nexus 1.4.1 we strongly recommend that you update the Nexus version you are targeting 1.4.2-SNAPSHOT and disregard this change. The 1.4.2-SNAPSHOT POMs have been updated properly and they do not require the following dependency management workaround.

<!- Workaround for swizzle-jira:1.3.3-SONATYPE-2, as it has an incorrect parent ->

If you have already generated the project, and you need to change the target Nexus version you will need to edit this new project’s POM. Open up the POM of your Nexus Plugin and find the section that defines properties. You will need to change the nexus-version property to target a Nexus version. After creating a project with the Nexus Plugin archetype, you will see a properties section of the POM that contains a ${nexusVersion} reference as follows:

<!-- Set the Nexus version here, against which you build the plugin -->

Click Next after setting the ${nexusVersion}, and voila, we have a nexus-plugin project.

Building and Deploying the Plugin Project

Your new Nexus plugin project has some sample components you can use as a starting point for your own plugin development.


You can now build this project and expand the bundle right into your nexus installation ${nexus-work-dir}/plugin-repository/


And when Nexus starts it will find the plugin and load it automatically. For this sample plugin, you should see the log message in the Nexus log:

Plugin manager “ACTIVATE” on plugin “” was successful.

As expected, you are now able to properly use the new plexus resource, I used curl to perform a GET against the default /sample/hello service added to my Nexus instance. The best part is that we have achieved everything you see above with absolutely zero code, Maven Archetypes really do simplify things for you :)



Published at DZone with permission of Damian Bradicich, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Harish Kaya replied on Sat, 2013/07/20 - 6:43am

I just followed steps in this blog . But when I deployed this zip as instructed in the blog , I get the following error in the nexus log .

java.lang.Noclassfound exception pointing to the RequestProcessor.class .

I found that this class is part of nexus-api.2.2.1.jar . And I searched for this jar in nexus installation and was unable to find it .

Is the blog written with assumption that the above mentioned jar will be there in nexus installation . If this is so, why is it not found in nexus installation. Then how the blogger has shown the output in his blog.

Note: I tried it with the latest nexus oss .

Harish Kaya replied on Mon, 2013/07/22 - 6:11am

I solved it . The problem was the jar was not there in the installation so added it to dependencies folder and added the info to the plugin descriptor . Now plugin is being detected by nexus oss with the "Activated successfully message " ,but ,..

But it's not working now . when I go to http://localhost:8081/nexus/service/local/sample/hello as per the instruction given I am not getting the desired output . Instead I am getting 

404 - Not Found

The server has not found anything matching the request URI

Please help .

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.