开发者

Maven plugin configuration in the multi module project

开发者 https://www.devze.com 2023-03-09 05:35 出处:网络
I\'m working on the multi module project. I want to run my plugin after build for one of the modules. This mojo should be only run directly from CLI and can not be attached to the phase as on some env

I'm working on the multi module project. I want to run my plugin after build for one of the modules. This mojo should be only run directly from CLI and can not be attached to the phase as on some environments we dont want to run this goal.

What is the best aproach to configure my plugin? Should it be configured within parent or should i configure it within module?

If I configure it within both parent and module will module configuration overwrite parent configuration?

If I configure it only within parent will I be able to run it from within module folder?

At the moment I have it configured only in my-module and i run it like this from parent folder

mvn -pl my-module groupId:artifactId:myGoal

It looks like i have to use fully qualified name. I guess this is because parent doesnt know anything about t开发者_Python百科his plugin.


If you want the plugin to be executed once per build, then use the @aggregator annotation on your Mojo. This signals to Maven to only execute the mojo once in the Maven build, unless it is explicitly bound to a lifecycle phase. You can find out more at the Mojo API Specification page.

If you want to avoid having to declare the fully-qualified name of the mojo, you can configure the groupId in the pluginGroups section of the settings.xml. You may also be able to specify it in the pluginManagement section of the pom.xml, though I'm not certain that this works for your use case.

0

精彩评论

暂无评论...
验证码 换一张
取 消