我一直使用eclipse和tomcat编写Spring / Web项目编程,但现在我正在进入Maven,我也在考虑使用jetty进行工作站测试。
我制作了一个示例Web应用程序,如果我在eclipse上运行tomcat,我转到 http:// localhost:8080 / TestJetty / 但是如果我做一个mvn jetty:run我必须访问来自 http:// localhost:8080 /
为什么?
我也可以设置eclipse来运行码头吗?什么是两者的利弊
答案 0 :(得分:1)
通常使用maven jetty插件的“jetty:run”目标,上下文路径为/
,除非它被contextPath配置条目覆盖:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>Your version..</version>
<configuration>
<webApp>
<contextPath>/mycontextpath</contextPath>
</webApp>
</configuration>
</plugin>
在Eclipse中,可能是您的项目名称被用作上下文路径。
关于利弊,它只是你的舒适程度,我更喜欢命令行,因此通常会使用“mvn jetty:run”在eclipse之外运行它