首页 > 学院 > 开发设计 > 正文

关于maven启动tomcat后出现访问不了主页

2019-11-08 01:30:16
字体:
来源:转载
供稿:网友

1.maven启动tomcat后会在src-main-webapp中查找对应在web.xml中配置的默认主页,所以在web.xml中配置了默认的主页以后,一定要使文件在webapp目录中。

2.关于pom中配置tomcat插件后的书写

    <build>        <plugins>            <plugin>                <groupId>org.apache.tomcat.maven</groupId>                <artifactId>tomcat6-maven-plugin</artifactId>                <configuration>                    <port>80</port>                    <path>/</path>                </configuration>            </plugin>        </plugins>    </build>

artifactId:tomcat的版本

port:tomcat的端口

path:项目被访问的路径,/即是默认访问,直接localhost访问主页。

3.在maven中使用版本管理器时一定要注意,要用<PRoperties>标签将版本进行包裹后,后续的版本才能被识别


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表