jetty去掉项目名称访问

对于web项目,访问路径是否包含项目名称等修改访问路径的配置方式:

我所使用的是maven进行管理,只需要在pom.xml中进行如下配置

<!-- jetty插件 jetty:run-->
    <build>
    <finalName>AutotestPlatform</finalName>
    <plugins>
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>9.2.7.v20150116</version>
                <configuration>
                    <scanIntervalSeconds>3</scanIntervalSeconds>
                    <webApp>
                        <contextPath>/AutotestPlatform/</contextPath>
                    </webApp>
                    <httpConnector>
                        <port>80</port>
                    </httpConnector>
                    <reload>automatic</reload>
                </configuration>
            </plugin>
    </plugins>
  </build> 

主要修改配置:

<webAppConfig>
<contextPath>/</contextPath>

</webAppConfig>

这样,访问是localhost/      上面是localhost/AutotestPlatform/

posted @ 2018-01-09 18:56  章三丰  阅读(1724)  评论(0编辑  收藏  举报