SpringBoot idea maven打包war

什么都不需要配置,跟着做!

pom.xml修改打包类型为war

<packaging>war</packaging>

排除内置Tomcat

        <!--因配置外部TOMCAT 而配置-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>

打包过程跳过测试

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
        </plugins>
    </build>

然后直接点击IDEA 右边的MAVEN面板,双击package.

原文地址:https://www.cnblogs.com/sweetchildomine/p/6861249.html