Sonatype provide the means and instructions to promote open source software to Maven central. I opted to refactor a small library from a previous post on JSON and publish it as a library called jsonunicode.
I opted to use SourceForge even though the service has been under fire recently. See also Advertising, Bundling, Community and Criticism. Still, they make it easy to do little things like publish the Maven-generated site and developers consuming a library via Maven are unlikely to be affected by the contentious issues.
I opted to use a dedicated Linux virtual machine for my build environment as it is relatively trivial to set up. I required:
- Java JDK (7) and Maven (3) for building
- git for source control
- ssh for (among other things) generating keys for passwordless git interaction
- gpg for signing build artefacts
See the Sonatype OSS Maven Repository Usage Guide for full instructions on how to deploy to a repo and promote to Maven central.
Aside from the configuration you see in the pom, my settings.xml ended up like this:
<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>USER</username> <password>PW</password> </server> <server> <id>sonatype-nexus-staging</id> <username>USER</username> <password>PW</password> </server> </servers> <profiles> <profile> <id>gpg</id> <properties> <gpg.passphrase>PASSPHRASE</gpg.passphrase> </properties> </profile> </profiles> <activeProfiles> <activeProfile>gpg</activeProfile> </activeProfiles> </settings>
The library is available via this dependency:
<dependency> <groupId>net.sf.jsonunicode</groupId> <artifactId>jsonunicode</artifactId> <version>1.0</version> </dependency>
The namespaces and license have changed from the previous form of the library but the functionality is largely the same.