Maven plugin executing another plugin

maven-2plugins

I'm trying to create a new plugin to package my latest project. I'm trying to have this plugin depend on the maven-dependency-plugin to copy all my projects dependencies.

I've added this dependency to my plugin's pom, but I can't get it to execute.

I have this annotation in my plugins main Mojo:

@execute goal="org.apache.maven.plugins:maven-dependency-plugin:copy"

I've tried a few other names for the goal, like dependency:copy and just copy but they all end with a message saying that the required goal was not found in my plugin. What am I doing wrong?

Secondary to this is where to I provide configuration info for the dependency plugin?

Best Answer

Use the Maven Mojo executor by Don Brown of Atlassian fame to run any other arbitrary plugin.

The Mojo Executor provides a way to to execute other Mojos (plugins) within a Maven 2 plugin, allowing you to easily create Maven 2 plugins that are composed of other plugins.