开发者

Calling maven goal from within another goal

开发者 https://www.devze.com 2023-01-27 10:40 出处:网络
I\'m trying to create a wrapper to a maven plugin that I found in the internet. My wrapper should do some work than call the execute on the original plugin\'s goal.

I'm trying to create a wrapper to a maven plugin that I found in the internet. My wrapper should do some work than call the execute on the original plugin's goal.

The examples I saw so far instantiate the other plugin, set all the variables, than call the execute method. I don't want to do this (if I can avoid it) because most of the instance variables are private.

Is there some way to make plexus inject an instance of the other plugin while populati开发者_开发问答ng the instance variables? Maven documentation is very vague about this... couldn't make it work.

Thanks, Rafael.


Take a look at MojoExecutor class from qulice-maven-plugin. The class does exactly what you're looking for, e.g.:

new MojoExecutor(mavenPluginManager, mavenSession)
  .execute("com.qulice:maven-qulice-plugin:1.0", "check", properties);
0

精彩评论

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

关注公众号