Spring Boot Maven打包去掉不需要的资源文件。
如果使用Spring Boot去掉不需要的文件,使用这个配置好像没有作用:
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>resouces</exclude>
<exclude>templates</exclude>
</excludes>
</resource>
</resources>
换一种方式:
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.3.3.RELEASE</version>
<configuration>
<mainClass>com.sspinfo.controller.WebApplication</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<excludes>
<exclude>**/resources/**</exclude>
<exclude>**/templates/**</exclude>
<exclude>**/com/test/**</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
相当于两步打包操作,先去掉资源文件再使用Spring Boot Maven打包。
更多推荐
Spring Boot Maven打包去掉不需要的文件
发布评论