Metamarkets Parent POMs
Usage
Add the following snippet at the top of your project pom.
<parent>
<groupId>com.metamx</groupId>
<artifactId>oss-parent</artifactId>
<version>3</version>
</parent>
Make sure your project pom includes an acceptable name, url, proper license, as well as a developers section.
<name>${project.groupId}:${project.artifactId}</name>
<url>https://github.com/metamx/<project></url>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0</url>
</license>
</licenses>
<developers>
<developer>
<name>John Doe</name>
<email>[email protected]</email>
<organization>Metamarkets Group Inc.</organization>
<organizationUrl>https://www.metamarkets.com</organizationUrl>
</developer>
</developers>
Include the maven release plugin as part of your <build><plugins>
section. Release plugin version and configuration are taken care of by the parent pom.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
</plugin>
Deploying Artifact
Requirements
-
Create a Sonatype account and request to be added to the list of users with deployment permissions.
-
Install GPG
# install gpg and friends
brew install gpg2 gpg-agent pinentry-mac
# setup pinentry for gpg-agent
echo "pinentry-program /usr/local/bin/pinentry-mac" >> ~/.gnupg/gpg-agent.conf
- Create a GPG key and publish it
-
Generate the key
gpg2 --gen-key
Use the default values for type, size, expiration, and add your name and email
-
Upload your key to a key-server
gpg2 --list-keys
-------------------------------- pub 4096R/ABCDEF12 2015-02-04 uid [ultimate] John Doe <[email protected]> ...
# use the key id as shown by gpg2 --list-keys gpg2 --keyserver hkp://pool.sks-keyservers.net --send-keys ABCDEF12
- Add the required server entries to your maven
settings.xml
file.
-
Add the
sonatype-nexus-staging
server entry to the<servers>
list. Replaceusername
andpassword
with your Sonatype username and password.<!-- sonatype-nexus-staging --> <server> <id>sonatype-nexus-staging</id> <username>username</username> <password>mypassword</password> </server>
See password encryption for information on how to encrypt your maven passwords.
-
Add the following sonatype-nexus-staging profile to the
<profiles>
list.<profile> <id>sonatype-nexus-staging</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <gpg.executable>gpg2</gpg.executable> </properties> </profile>
Releasing Artifacts
At the root of your project, do the following
# Make sure gpg-agent is running (this won't print anything)
eval $(gpg-agent --daemon)
# Prepare your release
mvn release:clean release:prepare
# Perform release
mvn release:perform
# During release:perform you will be prompted for your gpg passphrase
# If the release looks good, promote the artifact from staging to release
cd target/checkout && mvn -Prelease nexus-staging:release
Publishing changes to the parent POM
The parent pom can be published to Sonatype using the same steps described above.
Release Candidates
For more popular open source repositories, we declare a release candidate to let the community test things before declaring a stable release.
The process for releasing a release candidate
# Make sure gpg-agent is running (this won't print anything)
eval $(gpg-agent --daemon)
# Prepare your release
mvn release:clean release:prepare
If the open source project is not hosted under metamx/, make sure to update the metamx/ fork. Run the jenkins build job for the project and change 'Branch' to reflect your project's latest tag.