简体   繁体   中英

Maven plugin executing another plugin

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?

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.

Have you tried to create your own packaging type? Then you can define your own lifecycle mapping, ie bind goals to phases. In this case you can bind the dependency:copy-dependencies goal to your packaging phase and you don't have to wrap the goal into your own Mojo.

See also: How do I create a new packaging type for Maven?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM