MVN springboot 插件输出错误 tomcat 可部署 WAR

MVN springboot plugin outputs bad tomcat deployable WAR

我正在尝试制作一个 WAR 文件以从 Spring 启动项目中部署到 tomcat,使用命令行中的 maven。

这里推荐的POM文件我已经做了修改: http://blog.codeleak.pl/2014/04/how-to-spring-boot-and-thymeleaf-with-maven.html

但是,当我分解生成的 WAR 文件时,我看到这样的文件结构:

META-INF/  
org/  
WEB-INF/ 

这与 IntelliJ 输出的不同:

META-INF/  
WEB-INF/  

此外,WEB-INF 文件夹中还有许多丢失的文件夹和文件,例如application.properties 文件。

我错过了什么?我整天都在为此苦苦挣扎...

项目代码库基本包含在两个文件夹中

src/main/com/.../packagename  
src/main/resources

这是 POM 文件:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.packagename</groupId>
    <artifactId>findeme</artifactId>
    <version>1.0.0</version>
    <packaging>war</packaging>

    <repositories>
        <repository>
            <id>marketpower</id>
            <url>https://github.com/marketpower/sdk-java/raw/master/releases</url>
        </repository>
    </repositories>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.3.RELEASE</version>
        <relativePath />
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-websocket</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-messaging</artifactId>
        </dependency>
        <dependency>
            <groupId>net.sourceforge.nekohtml</groupId>
            <artifactId>nekohtml</artifactId>
            <version>1.9.21</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>

        <!-- TOMCAT -->
        <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>net.sf.jasperreports</groupId>
            <artifactId>jasperreports</artifactId>
            <version>6.1.0</version>
        </dependency>
        <dependency>
            <groupId>net.sf.barcode4j</groupId>
            <artifactId>barcode4j</artifactId>
            <version>2.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.xmlgraphics</groupId>
            <artifactId>batik-bridge</artifactId>
            <version>1.7</version>
        </dependency>
        <dependency>
            <groupId>net.sargue</groupId>
            <artifactId>mailgun</artifactId>
            <version>1.4.0</version>
        </dependency>

        <!-- payments -->
        <dependency>
            <groupId>com.marketpower</groupId>
            <artifactId>sdk</artifactId>
            <version>0.3.4</version>
        </dependency>

    </dependencies>

    <properties>
        <start-class>com.packagename.findeme.App</start-class>
        <java.version>1.8</java.version>
    </properties>


    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>

        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.jasper</include>
                </includes>
            </resource>
        </resources>
    </build>

</project>

尝试包括所有资源而不仅仅是 *.jasper 文件

    <resources>
        <resource>
            <directory>src/main/java</directory>
          <!--  <includes> -->
          <!--      <include>**/*.jasper</include> -->
         <!--   </includes> -->
        </resource>
    </resources>