Help with Maven MojosThe best sources of information are Developing Java Plugins for Maven 3.x and Maven: The Definitive Guide: Chapter 11 Writing Plugins. New MojosEach Mojo is a java file that extends AbstractMojo that contains an annotation specifying the goal name for the mojo and the maven lifecycle phase that it executes under by default. For, example package org.apache.commons.release.plugin.mojos; @Mojo(name = "detach-distributions", defaultPhase = LifecyclePhase.VERIFY, threadSafe = true) public class CommonsDistributionDetachmentMojo extends AbstractMojo { ..... } The variables in the mojo that are declared as private with the annotations @Parameter get imported to the Mojo by the existent maven variables or the declared <configuration>. For example, we have a boolean variable named dryRun declared as: @Parameter(property = "commons.release.dryRun", defaultValue = "false") private Boolean dryRun; <plugin> <groupId>org.apache.commons</groupId> <artifactId>commons-release-plugin</artifactId> <version>1.1</version> <configuration> <dryRun>true</dryRun> </configuration> </plugin> Unit testingWe've declared mock maven poms in the resources directory of the src/test folder, under which we've stored in subdirectories corresponding to the names of the mojos that they are testing. All variables that you wish to be available to your mojo must be specifically declared in the mock pom file. For example, we need to use the already existent MavenProject in the maven runtime by instead, in a test package declaring a class extending MavenProjectStub that returns values we wish to be used in testing. We then add this to our pom in the following declaration of the plugin: <plugin> <groupId>org.apache.commons</groupId> <artifactId>commons-release-plugin</artifactId> <configuration> <project implementation="org.apache.commons.release.plugin.stubs.DistributionDetachmentProjectStub" /> <workingDirectory>target/commons-release-plugin</workingDirectory> <distSvnStagingUrl>mockDistSvnStagingUrl</distSvnStagingUrl> </configuration> </plugin> @Rule public MojoRule rule = new MojoRule() { @Override protected void before() throws Throwable { } @Override protected void after() { } }; mojo = (CommonsSiteCompressionMojo) rule.lookupMojo("compress-site", testPom); DebuggingMaven ships with a debugger under the hood. It is suggested that you have a sandbox project in which you can run the goals or the plugin configuration. Once you have that set up you can run something like mvnDebug commons-release:detach-distributions |