Calling maven goal from within another 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);
精彩评论