Tag Archives: How-To

Publishing Your Artifacts to the Central Repository


October 12, 2011 By
Brian Fox

Sonatype makes it easy to add your projects to the Central Repository with a free, public hosting service called OSSRH. We first blogged about this back in 2009, but given the growth in the community, we thought some of you may not have seen that post, so we decided to update it.

Continue reading...

The best Maven how-tos from the Sonatype blog


July 15, 2011 By
Brian Fox

Sonatype is going through the archives and digging up articles that we think would be useful to developers using our tools. If you use Maven, keep reading the post below from Sonatype Vice President of Engineering Brian Fox on Maven best practices and how-tos. — We have a handful of Maven best practice and how-tos […]

Continue reading...

How to make a plugin that runs once during a build


May 22, 2009 By
Brian Fox

With it’s default behavior, Maven runs a plugin invocation for each project in a multi-module build. For plugins that operate on a single project at a time, this is what the author wants.

Some plugins are what we call “aggregators” which means they actually do want all the information about the full multi-module build before execution. These plugins, when run on a tree of projects cause Maven to resolve all the children before calling the plugin’s execute() method. In this mode a plugin executes just once, but effectively on the whole tree at once. (as a side note, you never want to bind an aggregator goal in your pom as this would cause the plugin to run an n! recursive build since the lifecycle would step into each child and execute the aggregator…which would cause Maven to reresolve all the children, etc)

Sometimes neither of those behaviors are what you want.

Continue reading...

Why Putting Repositories in your POMs is a Bad Idea


February 25, 2009 By
Brian Fox

I get this question frequently so it is time to write down my thoughts on the answer so I can stop repeating myself. Here’s the question: Should I put the urls to my repositories in my poms or in my settings? The short answer is: settings. The long answer is: it depends. There are two […]

Continue reading...

Best Practices for releasing with 3rd party SNAPSHOT dependencies


January 26, 2009 By
Brian Fox

The Maven Release plugin enforces best practices for releasing Maven artifacts. In summary, the release plugin performs the following steps: Validate no local changes against your SCM Validate that there are no SNAPSHOT dependencies Convert the modules to the to-be released version Ensure the build and Unit/Integration tests succeed Commit the changes to SCM, then […]

Continue reading...

Maven Continuous Integration Best Practices


January 15, 2009 By
Brian Fox

Continuous Integration is a development best practice that you need to be using in your process; it is an essential part of an efficient Software Development Lifecycle (SLDC).   If you aren’t using it already, then you should start, now.   The main benefit of Continuous Integration is the ability to flag errors as they are […]

Continue reading...