【问题标题】:Web application Path when using maven and Jetty使用 maven 和 Jetty 时的 Web 应用程序路径
【发布时间】:2014-03-09 19:39:49
【问题描述】:

我正在为我的 Web 应用程序使用 maven 和 jetty。我给出命令mvn jetty:run 来运行maven/jetty,它也将加载我的web 应用程序。但是我用来访问的路径是http://localhost:8080/filename.jsp,而我希望它是http://localhost:8080/myappname/filename.jsp

如何做到这一点?如果我必须从我的网络应用程序中发布特定文件以便您能够解决这个问题,请告诉我。

我在Remove application name after localhost in jetty找到了其他方式

【问题讨论】:

    标签: java maven build jetty maven-jetty-plugin


    【解决方案1】:

    来自这些文档:http://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html#jetty-run-goal

    我认为你只需要在 pom.xml 中配置 contextPath:

    <plugin>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-maven-plugin</artifactId>
      <configuration>
        <scanIntervalSeconds>10</scanIntervalSeconds>
        <webApp>
          <contextPath>/test</contextPath>
        </webApp>
      </configuration>
    </plugin>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-30
      • 2020-11-13
      • 1970-01-01
      • 2013-07-09
      • 1970-01-01
      相关资源
      最近更新 更多