DZone
Java Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Java Zone > The Road To Maven

The Road To Maven

Rob Gordon user avatar by
Rob Gordon
·
Mar. 24, 12 · Java Zone · Interview
Like (0)
Save
Tweet
5.38K Views

Join the DZone community and get the full member experience.

Join For 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:

<profile>
  <id>stage</id>
  <activation>
    <activeByDefault>true</activeByDefault>
  </activation>
  <repositories>
    <repository>
      <id>stage</id>
      <name>Nexus Staging Repo</name>
      <url>https://oss.sonatype.org/content/repositories/ukcorgordon-557/
      </url>
    </repository>
  </repositories>
</profile>

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:

<dependency>
  <groupId>uk.co.rgordon</groupId>
  <artifactId>oddjob</artifactId>
  <version>1.1.0</version>
</dependency>

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

 

 

Apache Maven

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

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Implementing Microservices Architectures
  • What Are the Best Performance Tuning Strategies for Your SQL Server Indexes?
  • How to Classify NSFW (Not Safe for Work) Imagery with AI Content Moderation using Java
  • What I Miss in Java, the Perspective of a Kotlin Developer

Comments

Java Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo