Maven 2 如何运行jetty:使用maven坐标定义的war运行war?
背景:我正在maven项目中设置一个功能测试模块。我们使用的测试 我已经设置了jetty插件(可以很好地使用Failsafe插件),但是我想做的是使用jetty从我们的主web模块部署war工件(在功能测试模块运行时,它刚刚安装到本地maven repo中) jetty插件有一个Maven 2 如何运行jetty:使用maven坐标定义的war运行war?,maven-2,jetty,maven,maven-jetty-plugin,Maven 2,Jetty,Maven,Maven Jetty Plugin,背景:我正在maven项目中设置一个功能测试模块。我们使用的测试 我已经设置了jetty插件(可以很好地使用Failsafe插件),但是我想做的是使用jetty从我们的主web模块部署war工件(在功能测试模块运行时,它刚刚安装到本地maven repo中) jetty插件有一个元素,它采用一个字符串路径来部署war。我更愿意使用web模块定义的maven坐标指定要部署的war。有没有办法做到这一点 可能的解决办法: 描述了使用cargo部署使用maven坐标指定的战争,但考虑到我们使用的是je
元素,它采用一个字符串路径来部署war。我更愿意使用web模块定义的maven坐标指定要部署的war。有没有办法做到这一点
可能的解决办法:
配置元素中提供该路径dependency:copy
,让整个maven jetty插件工作,但这是一个黑客行为(因为你实际上没有问任何问题,我想你是想对此发表意见)。当然,最终决定权属于你:)
以防万一,以下是我将如何在Cargo中实现这一点:
<dependencies>
<dependency>
<groupId>war group id</groupId>
<artifactId>war artifact id</artifactId>
<type>war</type>
<version>war version</version>
</dependency>
...
</dependencies>
...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<!-- Container configuration -->
<container>
<containerId>jetty6x</containerId>
<type>embedded</type>
</container>
<!-- Configuration to use with the container or the deployer -->
<configuration>
<deployables>
<deployable>
<groupId>war group id</groupId>
<artifactId>war artifact id</artifactId>
<type>war</type>
<properties>
<context>war context</context>
</properties>
</deployable>
</deployables>
</configuration>
<!-- Don't wait, execute the tests after the container is started -->
<wait>false</wait>
</configuration>
<executions>
<execution>
<id>start-container</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-container</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
...
</build>
战争集团id
战争神器id
战争
战争版
...
...
org.codehaus.cargo
cargo-maven2-plugin
码头6X
嵌入的
战争集团id
战争神器id
战争
战争背景
假的
启动容器
预集成测试
开始
停止容器
整合后测试
停止
...
...
而且我不认为这可以客观地称为“严重的过度杀伤力”。这个“严重的过度杀伤力”的评论来自我最初看到的cargo只与Geronimo一起使用——当时,我猜测它是一个部署工具,而不是一个webapp容器(我昨天之前没有听说过,耸耸肩)。无论如何,你肯定是对的,cargo是一个不错的选择,你上面分享的插件配置是我需要的99%。谢谢你的帮助和澄清。@Chas没问题。我很高兴我当时澄清了这一点。祝你好运