Category Archives: Book

Maven Tips and Tricks: Advanced Reactor Options


October 6, 2009 By Tim O'Brien

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:

-rf, –resume-from
    Resume reactor from specified project
-pl, –projects
    Build specified reactor projects instead of all projects
-am, –also-make
    If project list is specified, also build projects required by the list
-amd, –also-make-dependents
    If project list is specified, also build projects that depend on projects on the list

Continue reading

Maven Tips and Tricks: Describing Maven Plugins with help:describe


September 29, 2009 By Tim O'Brien

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.

Continue reading

Maven: The Definitive Guide 0.8 Published: New Content on Advanced Reactor Options


September 28, 2009 By Tim O'Brien

This release of The Definitive Guide adds a new chapter “Running Maven” with an important new section documenting the Advanced Maven Reactor options –projects, –also-make, –resume-from, and –also-make-dependents. If you are working on a multi-module build and you are interested in finding ways to customize the projects selected for a particular build, these options are invaluable. You can read it by:

Major changes in this version:

  1. A new chapter on running Maven that contains documentation of the Maven Reactor options. Thanks to Dan Fabulich for contributing to this chapter.
  2. Some typo/grammer fixes (from 0.7.3) in Chapter 3 that address some of the proofreading work from Grant Birchmeier via GetSatisfaction.

Continue reading

Maven: The Definitive Guide 0.7.2 Published


September 25, 2009 By Tim O'Brien

This release of The Definitive Guide adds some documentation for a few Maven 2.2.0 features, and it addresses a number of typos uncovered during our continued effort to produce a high-quality, free reference for Apache Maven. You can see for yourself by:

Major changes in this version:

  1. A new chapter on configuring Maven that contains some sections covering default mojo execution settings.
  2. A massive number of spelling errors, grammar errors, and typos fixed. Special thanks to Grant Birchmeier for finding issues in the Preface, Intro, and Installation chapters.

Continue reading

Maven Tips and Tricks: Creating an OSGi Project with Maven


September 22, 2009 By Tim O'Brien

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:

~/examples/osgi $ mvn org.ops4j:maven-pax-plugin:create-project \
  -DgroupId=org.sonatype.mhandbook \
  -DartifactId=osgi-project \
  -Dversion=1.0-SNAPSHOT
[INFO] Scanning for projects...
[INFO] artifact org.ops4j:maven-pax-plugin: checking for updates from central
[INFO] Building Maven Default Project
[INFO]    task-segment: [org.ops4j:maven-pax-plugin:create-project] (aggregator
-style)
[INFO] [pax:create-project]
[INFO] Selecting latest archetype release within version range [1,2)
[INFO] artifact org.ops4j.pax.construct:maven-archetype-osgi-project: checking
for updates from central
[INFO] Using following parameters for creating Archetype: maven-archetype-osgi-
project:1.0.3
[INFO] Parameter: packageName, Value: org.sonatype.mhandbook.osgi-project
[INFO] Parameter: archetypeVersion, Value: 1.0.3
[INFO] Parameter: groupId, Value: org.sonatype.mhandbook
[INFO] Parameter: archetypeArtifactId, Value: maven-archetype-osgi-project
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
[INFO] Parameter: archetypeGroupId, Value: org.ops4j.pax.construct
[INFO] Parameter: basedir, Value: ~/examples/osgi
[INFO] Parameter: package, Value: org.sonatype.mhandbook.osgi-project
[INFO] Parameter: artifactId, Value: osgi-project
[INFO] ********************* End of debug info from resources from generated POM
[INFO] Archetype created in dir: ~/examples/osgi/osgi-project

Once you’ve generated an OSGi project using the Pax Plugin, you will have the following directory structure:

Continue reading