从另一个目标中调用 Maven 目标

发布于 2024-10-04 05:13:54 字数 231 浏览 0 评论 0原文

我正在尝试为我在互联网上找到的 Maven 插件创建一个包装器。 我的包装器应该做一些工作,而不是调用原始插件目标的执行。

到目前为止我看到的示例实例化了另一个插件,设置所有变量,然后调用执行方法。我不想这样做(如果我可以避免的话),因为大多数实例变量都是私有的。

有没有办法让 plexus 在填充实例变量时注入另一个插件的实例? Maven 文档对此非常模糊...无法使其工作。

谢谢, 拉斐尔.

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 populating the instance variables? Maven documentation is very vague about this... couldn't make it work.

Thanks,
Rafael.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情感失落者 2024-10-11 05:13:54

看看 MojoExecutor 类来自 qulice-maven-plugin.该课程正是您所寻找的,例如:

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

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);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文