在 Maven 中链接 mojo

发布于 2024-12-20 21:25:08 字数 279 浏览 3 评论 0原文

我正在使用 Maven Cargo 插件在 Tomcat 中远程部署 Servlet。当我更新代码时,我必须运行两个 mojo,一个用于编译新的战争(package),另一个用于远程部署战争(cargo:deployer-redeploy) >)。

我希望能够简单地调用 cargo:deployer-redeploy ,它会调用源代码的编译和新战争的创建并远程部署。本质上,我希望重新部署 mojo 依赖于包 mojo(在 ant 术语中)。

I'm using the maven cargo plugin to remotely deploy a servlet in tomcat. When I make updates to the code I have to run two mojos, one for compiling a new war (package), and one for deploying the war remotely (cargo:deployer-redeploy).

I want to be able to simply invoke cargo:deployer-redeploy and it invokes the compilation of the source code and creation of a new war and deploys that remotely. Essentially I want the redeploy mojo to be dependant on the package mojo (in ant terminology).

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

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

发布评论

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

评论(1

心不设防 2024-12-27 21:25:08

您可以将货物插件绑定到 package 之后的阶段(例如 verify),因此在 pom 的插件配置部分中,输入如下内容:

            <executions>
                <execution>
                    <id>deploy</id>
                    <phase>verify</phase>
                    <goals>
                        <goal>redeploy</goal>
                    </goals>
                </execution>
            </executions>

当您运行 < code>mvn verify 它将运行 war 插件(作为 package 的一部分),然后运行 ​​Cargo。

You can just bind the cargo plugin to a later phase than package (e.g. verify), so in the plugin's configuration section in the pom, put something like:

            <executions>
                <execution>
                    <id>deploy</id>
                    <phase>verify</phase>
                    <goals>
                        <goal>redeploy</goal>
                    </goals>
                </execution>
            </executions>

When you run mvn verify it will run the war plugin (as part of package) then cargo.

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