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 Mojos
Each Mojo is a java file that extends
specifies the goal commons-release:detach-distributions that is to occur during the VERIFY maven
lifecycle.
The variables in the mojo that are declared as private with the annotations
that can be configured by
And, because we've set the property here (as in the 1.1 release), you can, on the command line,
use the following -Dcommons.release.dryRun=true .
Unit testing
We've declared mock maven poms in the
Also note here we are declaring other values that we are using in the testing of the plugin. We then retrieve
our instantiated mojo by declaring a MojoRule in our test class,
and then retrieve the mojo by newing up a File pointed to the path of the mock pom, and then
making the following call:
where we are trying to get the mojo with the compress-site goal.
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
which exposes a remote debugger on port 8000 and halts the maven process until you attach a remote debugger
to that port. Once you have a remote debugger attached the maven process continues and stops at any
breakpoints that you have set up in your project.
|