Over a million developers have joined DZone.

The Road To Maven

DZone's Guide to

The Road To Maven

· Java Zone
Free Resource

Bitbucket is for the code that takes us to Mars, decodes the human genome, or drives your next car. What will your code do? Get started with Bitbucket today, it's free.

Maven is one of those projects I’ve looked at periodically over the years but I’ve never been persuaded by the payback of a learning curve that looks pretty steep from the bottom of a mound of XML. On my most recent day trip to Maven, however, I found a reason to stay.

The reason was a Sonatype Video that showed materializing an Eclipse project from a dependency. I thought of the number of times I’d manually done this, and the time it took, and the payback was obvious.

So where to begin on the road to Maven? I quite like Oddjob’s own Oddjob/Ant build combination. It gives a graphical view to what would otherwise be a mass of Ant build files, and includes the ability to re-run parts without needing to re-run everything. Here is a picture of it in action:

Oddjob Building Itself
I looked at embedding Maven so I could have a similar Oddjob Maven build but this did not seem a well trodden path. So, reluctant to give up my GUI in favour of a big messy console build, I decided against switching completely from Ant to Maven, at least for the time being.

Instead I decided to focus on getting the core Oddjob jars in Maven Central. The road most travelled appears to go via the Sonatype OSS Repository so down it I went. Documentation in the form of the Sonatype OSS Maven Repository Usage Guide was easy to follow and soon I had a variation of the example Ant task uploading jars to a Staging repository.

The docs were a bit light on testing the Staged artefacts but it proved as simple as deleting the locally installed jars from my .m2/repository/uk/co/rgordon repository location and adding the staging repository to my .m2/settings.xml file like this:

      <name>Nexus Staging Repo</name>

Which can be edited and updated using the Eclipse Preferences seen here:

Eclipse Maven Settings

(Although I seemed to need to restart Eclipse to pick up the new settings)

And before this will work YOU MUST CLOSE the staging repository!

Having proved my jars worked with a small project it’s a few more clicks to release the jars to Maven Central and here they are.

So now you too can embed Oddjob in your own Maven project. Just add these lines to your POM:


Where next on the road to Maven? I don’t know yet but I’m quite looking forward to it.



Are you using Bitbucket to accomplish your company's mission? Share your company’s mission with #Forthecode for a chance to be featured on our homepage, our social media channels, or win a free t-shirt!


Published at DZone with permission of Rob Gordon, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}