2009 Maven and Nexus tips and tricks roundup


January 20, 2010 By

Here is a summary of “Tips and Tricks” posts published over the course of the past year on the Sonatype blog. Enjoy!

  • Nexus Tips and Tricks: Defining Roles for Staging
    Staging is one of the most outstanding features in Nexus Pro. It allows you to add a checkpoint before releasing software, so developers can deploy release candidates into the staging repository, testers can test the release candidates, and release managers can then choose to promote or drop a release. As we can imagine, the Nexus role for developers and testers should be different when configuring staging as one role is responsible for the deployment of staged artifacts and the other is responsible for testing and promoting tested artifacts. In this post, I will describe how to configure appropriate roles for developers and testers.
  • Nexus Tips and Tricks: Publishing Maven Sites to Nexus 1.4
    Nexus Professional provides a new hosted repository type: a Maven Site repository. This repository can be used to hold a Maven-generated web site. In addition to publishing your artifacts to a Nexus repository, you can also use Nexus to serve your project’s web sites.
  • Maven Tips and Tricks: Optimizing with the Maven Dependency Plugin
    On larger projects, additional dependencies often tend to creep into a POM as the number of dependencies grow. As dependencies change, you are often left with dependencies that are not being used, and just as often, you may forget to declare explicit dependencies for libraries you require. Because Maven 2.x includes transitive dependencies in the compile scope, your project may compile properly but fail to run in production.
  • Maven Tips and Tricks: Grouping Dependencies
    Maven can be used to manage everything from simple, single-project systems to builds that involve hundreds of inter-related submodules. Part of the learning process with Maven isn’t just figuring out the syntax for configuring Maven, it is learning the “Maven Way”—the current set of best practices for organizing and building projects using Maven. This is the first in a series of posts that will attempt to distill some of this knowledge to help you adopt best practices from the start without having to wade through years of discussions on the Maven mailing lists.
  • Maven Tips and Tricks: Encrypting Passwords
    The first time I configured Maven to authenticate against a protected repository manager, I was somewhat disturbed by presence of unencrypted passwords in my home directory. While many of us have grown accustomed to leaving a few unencrypted passwords here or there in a production system, it just didn’t seem appropriate to leave a password for something like a repository manager sitting in a known file location (~/.m2/settings.xml). Luckily, Maven provides a very easy method for encrypting passwords. In this post, I’ll walk you through the process.
  • Maven Tips and Tricks: Advanced Reactor Options
    Starting with the Maven 2.1 release, there are new Maven command line options which allow you to manipulate the way that Maven will build multimodule projects. These new options are…
  • Maven Tips and Tricks: Describing Maven Plugins with help:describe
    If you do any non-trivial customization of a Maven build, you’ll understand that you need to have a good understanding of Maven Plugin configuration. What configuration parameters are available for a particular plugin goal? Most users tend to Google for the particular Maven plugin and rely on the fact that most Maven-generate plugin sites contain a standard list of goals and configuration parameters. While this works, there is a better way: use the Maven Help plugin’s describe goal to list the available configuration parameters for a Maven plugin.
  • Maven Tips and Tricks: Creating an OSGi Project with Maven
    This post is a quick start guide to using the Maven PAX plugin to create OSGi project and start an OSGi runtime environment (Apache Felix). First, use the Maven Pax Plugin from OPS4J, and call the create-project goal. The following command-line will create a multi-module project with a groupId of org.sonatype.mhandbook, an artifactId of osgi-project, and a version of 1.0-SNAPSHOT…
  • Maven Tips and Tricks: Browsing and Indexing Repositories with m2eclipse
    The m2eclipse plugin allows you to browse and manipulate repository indexes. Using the Maven Repository view in m2eclipse you can…
  • Maven Tips and Tricks: Using GitHub
    Sonatype uses GitHub to host a number of projects including all of our books. It has been a very valuable tool for us, and we’ve already seen great benefits. The social, interactive nature of the tool allows people interested in the book to keep up with the development of the content, and we’ve already had a few contributors show up and help us write more content.
  • Maven Continuous Integration Best Practices
    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 introduced into a system instead of waiting multiple days for test failures and critical errors to be identified during the QA cycle. This post isn’t about the virtues of using CI, it’s about how to setup an optimal environment in a Maven shop. Here are seven tips for running Maven builds in a CI system such as Hudson.