使用spring boot maven插件重新打包后,JAR文件中缺less资源

我的应用程序使用一些额外的文件,我有资源文件夹内。 当我使用Maven进行常规构build并将我的应用程序打包到JAR中时,我可以看到我的所有资源,以便解压缩该文件。

但是当我创build一个docker镜像时,我使用了spring-boot-maven-plugin来使我的JAR文件可执行。 出于某种原因, 我的资源没有被添加到新的重新包装的JAR中 。 此外,我甚至无法解压,因为它已经损坏。

这是我在我的pom.xml中设置重新打包目标的方式:

<id>prod</id> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>1.5.3.RELEASE</version> <configuration> <mainClass>ApplicationName</mainClass> <executable>true</executable> <arguments> <argument>--spring.profiles.active=prod</argument> </arguments> <!--<addResources>true</addResources>--> </configuration> <executions> <execution> <goals> <goal>repackage</goal> </goals> <configuration> <!--<includeSystemScope>true</includeSystemScope>--> <!--<layout>JAR</layout>--> </configuration> </execution> </executions> </plugin> </plugins> </build> 

我想补充说,当我在泊坞窗中运行我的图像它工作正常, 但所有需要的资源都缺less

有没有人遇到同样的问题? 或者,也许你可以build议如何解决它。