This blog has moved!

You will be automatically redirected to the new address. If that does not occur, visit
http://blog.xeiam.com
and update your bookmarks.

Wednesday, March 6, 2013

A Practical Guide to Uploading Artifacts to Maven Central

This blog post takes you through the steps you need to take to get your Java artifacts (Jars, JavaDocs, Sources, etc.) uploaded to Maven Central. A lot of the steps are already well documented on Sonatype's Maven Repository Usage Guide, and this post will refer to it heavily but fill in the spots where that guide is a bit weak. First off, here are the main references you will need:

References

https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide https://docs.sonatype.org/display/Repository/How+To+Generate+PGP+Signatures+With+Maven

Heads Up Mac Users!

If you get a complaint from Maven about Java Home not being properly set on your Mac do this at the CLI:
 echo $JAVA_HOME  
 export JAVA_HOME=$(/usr/libexec/java_home)  

Instructions

Follow the instructions in the first reference up to, but not including step 7a.3 Stage a Release. At this point you've already gotten a Sonatype account, pushed snapshots to Sonatype's snapshots repo, and got your PGP keys setup on your machine. Now to upload your non-snapshot releases to Maven Central, you need to run some Maven commands from the CLI. Make sure you have Git installed on your machine as well. The following Maven commands work for multi-module Maven projects as well as single-jar projects. You'll need to adapt these commands to your specific project. These instructions are just a supplement to step 7a.3 on Sonatype's guide. Here are the CLI commands I ran to release XChange version 1.3.0...

Tip!

Leave the -SNAPSHOT in your pom.xml. The release plugin removes it and increments to the next snapshot version for you automatically. It also tags the commit for you too.

First Do a Dry Run

note: replace "xchange" with your own artifactId, replace 1.3.0 with your current version.
 mvn clean  
 mvn release:clean  
 mvn --batch-mode -Dtag=xchange-1.3.0 -DreleaseVersion=1.3.0 -DdevelopmentVersion=1.3.1-SNAPSHOT -DdryRun=true release:prepare  
 mvn release:rollback  

Then Do the Real Thing

note: replace "xchange" with your own artifactId, replace 1.3.0 with your current version.
 mvn release:clean  
 mvn --batch-mode -Dtag=xchange-1.3.0 -DreleaseVersion=1.3.0 -DdevelopmentVersion=1.3.1-SNAPSHOT release:prepare  
 mvn release:perform -Darguments=-Dgpg.passphrase=PASSPHRASE  

The Final Stretch

The last thing to do now is to use the Sonatype web interface to release the artifacts. Just follow the instructions starting at Step 8a on Sonatype's Guide.

Done!

After a couple hours of waiting, your artifacts will be available on Maven Central. I found that it takes even longer for them to be available on search.maven.org, but as soon as they show up in the repository, you and others can access the artifacts by adding a dependency to the pom.xml file in a Maven project.

Tuesday, March 5, 2013

XChart 2.0.0 Released!

Alert! A couple bugs were reported int the 2.0.0 release. Version 2.1.0 with these important bugs fixes is now available here: http://xeiam.com/xchart.jsp. Follow us on Twitter for release announcements.

XChart, A Simple Charting Library for Java, licensed under the Apache 2.0 license, version 2.0.0 was released today! This release brings many exciting features most notably bar charts, themes, and logarithmic axes. The current features of the XChart library include:
  • No additional dependencies
  • ~85KB Jar
  • Line charts
  • Scatter charts
  • Area Charts
  • Bar Charts
  • Error bars
  • Logarithmic axes
  • Date and category X-Axis
  • Multiple series
  • Extensive customization
  • Themes
  • Right-click, Save-As...
  • User-defined axes range
  • Custom legend placement
A Swing demo is also available for download along with the main xchart jar here. To run the demo from the command line type the following:
 cd /path/to/xchart-demo/jar/  
 java -cp xchart-demo-2.0.0.jar:xchart-2.0.0.jar com.xeiam.xchart.demo.XChartDemo  
Following is a sampling of some of the charts from the demo app...

Tuesday, February 5, 2013

Hello World!

Hello World! We're excited to finally have a blog!

How about some relevant Xeiam links for the first post...