1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
| /**
* Execute a Mojo using the MojoExecutor.
*
* @goal execute-mojo
*/
public class MojoExecutorMojo extends AbstractMojo {
/**
* Plugin to execute.
*
* @parameter
* @required
*/
private Plugin plugin;
/**
* Plugin goal to execute.
*
* @parameter
* @required
*/
private String goal;
/**
* Plugin configuration to use in the execution.
*
* @parameter
*/
private XmlPlexusConfiguration configuration;
/**
* The project currently being build.
*
* @parameter default-value="${project}"
* @parameter required
* @readonly
*/
private MavenProject mavenProject;
/**
* The current Maven session.
*
* @parameter default-value="${session}"
* @parameter required
* @readonly
*/
private MavenSession mavenSession;
/**
* The Maven BuildPluginManager component.
*
* @component
* @required
*/
private BuildPluginManager pluginManager;
public void execute() throws MojoExecutionException {
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 )
);
} |
Partager