web项目tomcat启动url自定义(去掉项目名)

 通常,使用maven构建web项目,启动时默认的访问路径:

http://ip:port/项目名

很多时候我们不喜欢这样 访问,我们希望下面的访问方式:

http://ip:port

如果是本地的tomcat,这个就很好解决,只要设置下tomcat就可以

但是如果是maven项目,使用的是tomcat插件,是通过配置来设置

设置如下:

<!-- 配置Tomcat插件 -->
<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.2</version>
    <configuration>
        <port>8081</port>
        <path>/</path>
    </configuration>
</plugin>

猜你喜欢

转载自www.cnblogs.com/ylht/p/10200511.html