Maven central is the place where ultimately all maven artifacts gets published. Hudson plugins should end up here (if the groupid of your plugin is org.hudsonci.plugins) However, directly publishing to maven central is not allowed. Every one publishes to a intermediate Nexus repository where they have account and access. Then the artifacts from that repository get pushed to maven central. Hudson project uses OSS Nexus repository. Publishing your plugin to OSS Nexus repositoryTo publish to Nexus OSS Repository you need an account.
Read the document Sonatype OSS Maven Repository Usage Guide for more details Setting up PGP KeyThis step is one time setup. In order to publish to OSS Nexus repository, you need a valid PGP key published to a key server. Read this article on how to set up your PGP key. If you set up a Pass Phrase for your PGP key, you could add it to your settings file (~/.m2/settings.xml) as shown below. <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 http://maven.apache.org/xsd/settings-1.0.0.xsd"> .. .. <profiles> <profile> <id>development</id> <properties> <gpg.passphrase>{Your PGP key Pass Phrase}</gpg.passphrase> </properties> </profile> </profiles> <activeProfiles> <activeProfile>development</activeProfile> </activeProfiles> .. .. </settings> If you don't want to put it in settings.xml file, other option is to pass it to the maven release:perform command using -Dgpg.passphrase=<pass-phrase> Specifying your OSS Nexus repository credentialsThis is also a one time setup. For pushing your plugin to OSS Nexus repository, maven need to know your credentials. You could permanently add it the settings file (~/.m2/settings.xml). <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 http://maven.apache.org/xsd/settings-1.0.0.xsd"> .. .. <servers> <server> <id>sonatype-nexus-snapshots</id> <username>your-sonatype-jira-id</username> <password>your-sonatype-jira-pwd</password> </server> <server> <id>sonatype-nexus-staging</id> <username>your-sonatype-jira-id</username> <password>your-sonatype-jira-pwd</password> </server> </servers> .. .. </settings> If you don't want to put it in settings.xml file, other option is to pass it to the maven release:perform command using -Dusername and -Dpasseord Adding the Nexus OSS repository information to your POMAdding the Nexus OSS release repository information in your POM is easy. Just include the following in your plugin POM where the distribution management information is specified <parent> <groupId>org.jvnet.hudson.plugins</groupId> <artifactId>hudson-plugin-parent</artifactId> <!-- The version of hudson platform --> <version>1.398</version> </parent Note: You need version 1.398 or later to deploy to OSS Nexus repository. If you are using older version then you should add the following to your plugin <distributionManagement> <snapshotRepository> <id>sonatype-nexus-snapshots</id> <name>Sonatype Nexus Snapshots</name> <url>${sonatypeOssDistMgmtSnapshotsUrl}</url> </snapshotRepository> <repository> <id>sonatype-nexus-staging</id> <name>Nexus Release Repository</name> <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url> </repository> </distributionManagement> Specifying SCM informationSpecify the SCM information where your plugin is hosted. You need this for maven-release-plugin to create the release tag in your SCM. <scm> <connection>scm:git:git://github.com/hudson/hudson.git</connection> <developerConnection>scm:git:ssh://git@github.com/hudson/hudson.git</developerConnection> <url>https://github.com/hudson/hudson</url> </scm> Specifying the sections where your plugin should appear in the update centerUpdate center displays the plugins under certain sections. In order to specify under which sections your plugin should appear add the property <hudsonTags> to your pom.xml. For example <groupId> .. </groupId> <artifactId> .. </artifactId> .. <properties> <hudsonTags>scm,builder</hudsonTags> </properties> .. Staging your releaseStage the release of your plugin using maven commands mvn release:clean
mvn release:prepare -DpushChanges=false
Above two steps prepare your plugin for releasing. It creates a release tag as specified by you in the release prepare step. mvn release:perform -DlocalCheckout=true
Maven will checkout the release tag locally, then build and deploy it into Nexus staging repository.
Releasing to Maven Central
Announcing your Plugin and the Wiki pageTo ensure that your plugin details are available on the Hudson wiki you need to do the following. If you are unable to create a page, request wiki-edit permission via the Dev mailing list
Finally, announce your plugin on the Hudson Developer list. If your plugin is hosted outside of Hudson be sure to include that in the announcement so that it can included in the Update Center JSON script. Want More Help?In his blog Henrik Lynggard Hansen has explain his experience with releasing the Project Health Report plugin. This four part blog is a very useful resource. Part 1: Getting access |