如何从父母pom''mvn jetty:run'?(How to 'mvn jetty:run' from a parent pom?)

编程入门 行业动态 更新时间:2024-10-25 10:28:38
如何从父母pom''mvn jetty:run'?(How to 'mvn jetty:run' from a parent pom?)

我有一个包含多个.war包的多模块项目。 我希望能够在父pom上'mvn jetty:run',并将每个子模块的.wars部署在同一个嵌入式jetty实例上。

我能够从每个子模块成功运行'mvn jetty:run',但是当我在父pom上运行它时它会失败并跳过子模块。

尝试从父pom运行'mvn jetty:run'会导致以下结果:

[错误]无法在项目FlashCards_App上执行目标org.mortbay.jetty:maven-jetty-plugin:6.1.16:run default-cli:Webapp源目录C:\ dev \ sour ce_code \ FlashCards_App \ src \ main \ webapp不存在 - > [帮助1]

确实,父pom上没有webapp目录。

这是我的pom的摘录。 完整的文件可以在这里找到 。

<modules> <module>FlashCards_Domain</module> <module>FlashCards_GWT</module> <module>FlashCards_Service</module> <module>FlashCards_Service_SpringData</module> <module>FlashCards_Service_Jpa</module> <module>FlashCards_WebServices</module> <module>FlashCards_Struts</module> <module>FlashCards_Test</module> </modules> <build> <plugins> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <version>${jetty.version}</version> </plugin> </plugins> </build>

这与2009年在这篇文章中提出的问题基本相同。 已经有几年了,我想知道现在是否有其他选择。 前一篇文章提出了两个解决方案(1)使用货物插件和(2)从子模块建立姐妹战争。

I have a multi-module project that includes several .war packages. I would like to be able to 'mvn jetty:run' on the parent pom and have each of the sub-modules's .wars deployed on the same embedded jetty instance.

I am able to successfully run 'mvn jetty:run' from each of the the sub-modules, but when I run it on the parent pom it fails and skips the sub-modules.

Trying to run 'mvn jetty:run' from the parent pom results in the following:

[ERROR] Failed to execute goal org.mortbay.jetty:maven-jetty-plugin:6.1.16:run default-cli) on project FlashCards_App: Webapp source directory C:\dev\sour ce_code\FlashCards_App\src\main\webapp does not exist -> [Help 1]

It's true there is no webapp directory on the parent pom.

Here's an excerpt from my pom. The full file can be found here.

<modules> <module>FlashCards_Domain</module> <module>FlashCards_GWT</module> <module>FlashCards_Service</module> <module>FlashCards_Service_SpringData</module> <module>FlashCards_Service_Jpa</module> <module>FlashCards_WebServices</module> <module>FlashCards_Struts</module> <module>FlashCards_Test</module> </modules> <build> <plugins> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <version>${jetty.version}</version> </plugin> </plugins> </build>

This is basically the same question asked in 2009 in this post. It's been a few years and I'm wondering if there are any other options available now. The previous post proposes two solutions (1) using cargo plugin and (2) building sister wars from a sub-module.

最满意答案

你最好的镜头可能是配置jetty插件来运行多个webapps 。 我不确定它是否可以从您的父pom中运行,因此您可能必须使用您的模块作为“启动器”webapp,或在您的父项目中创建“虚拟webapp”。

Your best shot is probably to configure the jetty plugin to run multiple webapps. I'm not sure if it would work from your parent pom though, so you might have to use on of your modules as the "launcher" webapp, or create a "dummy webapp" in your parent project.

更多推荐

本文发布于:2023-08-04 08:13:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1413159.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:父母   pom   mvn   parent   run

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!