部署springboot项目时 打包成jar时包中html,js,css文件缺失

问题

打包出来的jar包里面没有html,js,css文件

解决方案

pom.xml文件下的build选项中的src/main/resources的目录下 添加配置

<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>**/*.properties</include>
                    <include>**/*.xml</include>
                </includes>
                <filtering>false</filtering>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.properties</include>
                    <include>**/*.xml</include>
                    <include>**/*.css</include>
                    <include>**/*.js</include>
                    <include>**/*.html</include>
                </includes>
                <filtering>false</filtering>
            </resource>
        </resources>
</build>
posted @ 2019-04-10 15:28  Draymonder  阅读(4763)  评论(0编辑  收藏  举报