|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.twdata.maven.mojoexecutor.MojoExecutor
public class MojoExecutor
Executes an arbitrary mojo using a fluent interface. This is meant to be executed within the context of a Maven 2 mojo. Here is an execution that invokes the dependency plugin:
executeMojo(
plugin(
groupId("org.apache.maven.plugins"),
artifactId("maven-dependency-plugin"),
version("2.0")
),
goal("copy-dependencies"),
configuration(
element(name("outputDirectory"), "${project.build.directory}/foo")
),
executionEnvironment(
project,
session,
pluginManager
)
);
| Nested Class Summary | |
|---|---|
static class |
MojoExecutor.Element
Element wrapper class for configuration elements |
static class |
MojoExecutor.ExecutionEnvironment
Collects Maven execution information |
| Constructor Summary | |
|---|---|
MojoExecutor()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
artifactId(java.lang.String artifactId)
Wraps the artifact id string in a more readable format |
static org.codehaus.plexus.util.xml.Xpp3Dom |
configuration(MojoExecutor.Element... elements)
Builds the configuration for the goal using Elements |
static MojoExecutor.Element |
element(java.lang.String name,
MojoExecutor.Element... elements)
Constructs the element containg child elements |
static MojoExecutor.Element |
element(java.lang.String name,
java.lang.String value)
Constructs the element with a textual body |
static void |
executeMojo(org.apache.maven.model.Plugin plugin,
java.lang.String goal,
org.codehaus.plexus.util.xml.Xpp3Dom configuration,
MojoExecutor.ExecutionEnvironment env)
Entry point for executing a mojo |
static MojoExecutor.ExecutionEnvironment |
executionEnvironment(org.apache.maven.project.MavenProject mavenProject,
org.apache.maven.execution.MavenSession mavenSession,
org.apache.maven.plugin.PluginManager pluginManager)
Constructs the MojoExecutor.ExecutionEnvironment instance fluently |
static java.lang.String |
goal(java.lang.String goal)
Wraps the goal string in a more readable format |
static java.lang.String |
groupId(java.lang.String groupId)
Wraps the group id string in a more readable format |
static java.lang.String |
name(java.lang.String name)
Wraps the element name string in a more readable format |
static org.apache.maven.model.Plugin |
plugin(java.lang.String groupId,
java.lang.String artifactId)
Defines the plugin without its version |
static org.apache.maven.model.Plugin |
plugin(java.lang.String groupId,
java.lang.String artifactId,
java.lang.String version)
Defines a plugin |
static java.lang.String |
version(java.lang.String version)
Wraps the version string in a more readable format |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MojoExecutor()
| Method Detail |
|---|
public static void executeMojo(org.apache.maven.model.Plugin plugin,
java.lang.String goal,
org.codehaus.plexus.util.xml.Xpp3Dom configuration,
MojoExecutor.ExecutionEnvironment env)
throws org.apache.maven.plugin.MojoExecutionException
plugin - The plugin to executegoal - The goal to executeconfiguration - The execution configurationenv - The execution environment
org.apache.maven.plugin.MojoExecutionException - If there are any exceptions locating or executing the mojo
public static MojoExecutor.ExecutionEnvironment executionEnvironment(org.apache.maven.project.MavenProject mavenProject,
org.apache.maven.execution.MavenSession mavenSession,
org.apache.maven.plugin.PluginManager pluginManager)
MojoExecutor.ExecutionEnvironment instance fluently
mavenProject - The current Maven projectmavenSession - The current Maven sessionpluginManager - The Maven plugin manager
public static org.codehaus.plexus.util.xml.Xpp3Dom configuration(MojoExecutor.Element... elements)
elements - A list of elements for the configuration section
public static org.apache.maven.model.Plugin plugin(java.lang.String groupId,
java.lang.String artifactId)
groupId - The group idartifactId - The artifact id
public static org.apache.maven.model.Plugin plugin(java.lang.String groupId,
java.lang.String artifactId,
java.lang.String version)
groupId - The group idartifactId - The artifact idversion - The plugin version
public static java.lang.String groupId(java.lang.String groupId)
groupId - The value
public static java.lang.String artifactId(java.lang.String artifactId)
artifactId - The value
public static java.lang.String version(java.lang.String version)
version - The value
public static java.lang.String goal(java.lang.String goal)
goal - The value
public static java.lang.String name(java.lang.String name)
name - The value
public static MojoExecutor.Element element(java.lang.String name,
java.lang.String value)
name - The element namevalue - The element text value
public static MojoExecutor.Element element(java.lang.String name,
MojoExecutor.Element... elements)
name - The element nameelements - The child elements
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||