SpringBoot使用maven-tomcat-plugin启动

SpringBoot使用maven-tomcat-plugin启动

前提条件:已配置了SpringBoot打成War包
不添添加Servlet依赖报: SpringServletContainerInitializer cannot be cast to javax.servlet.ServletContainerInitializer

添加Servlet-api依赖

<!-- 不添加该依赖tomcat7:run无法运行项目 -->
<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.1.0</version>
    <scope>provided</scope>
</dependency>

添加插件

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.2</version>
    <configuration>
        <port>8080</port>
        <path>/</path>
        <uriEncoding>utf-8</uriEncoding>
    </configuration>
</plugin>

posted on 2017-10-20 12:11  IceWee  阅读(2827)  评论(0编辑  收藏  举报

导航