maven 配置jetty-maven-plugin contextPath元素内容要用'/'开头

来源:互联网 发布:数据库概论答案 编辑:程序博客网 时间:2024/06/05 21:00
HTTP ERROR 404Problem accessing /strutsByMavenJettyPlugin/index.jsp. Reason:    Not FoundPowered by Jetty:// 9.4.7.v20170914

mvn jetty:run 后
访问 http://localhost:8080/项目名/index.jsp 出现上述问题:
浏览器访问出现问题

原因是:
pom.xml中:

<webApp>            <contextPath>${project.artifactId}</contextPath></webApp>

contextPath 元素 缺少 ‘/’
改为:

<webApp>            <contextPath>/${project.artifactId}</contextPath></webApp>

问题消失。

官方文档:
http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html#configuring-your-webapp