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

ant*_*siy 6 maven docker spring-boot spring-boot-maven-plugin docker-maven-plugin

我的应用程序使用资源文件夹中的一些附加文件。当我使用 Maven 进行常规构建并将我的应用程序打包到 JAR 中时,如果我解压缩此存档,我可以看到所有资源。

但是当我创建 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>
Run Code Online (Sandbox Code Playgroud)

我想补充一点,当我在 docker 中运行我的映像时,它工作正常,但缺少所有所需的资源

有人遇到同样的问题吗?或者您可以建议如何修复它。