Spring Boot Maven 插件 - 没有 BOOT-INF 目录 [英] Spring Boot Maven Plugin - No BOOT-INF directory

查看:82
本文介绍了Spring Boot Maven 插件 - 没有 BOOT-INF 目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

spring-boot-maven-plugin 1.3.8.RELEASE版本和1.4.0.RELEASE版本之间——生成的包结构发生了变化(如果你解压了uber jar文件)1.3.8.RELEASE com、lib、META-INF 和 org 目录1.4.0.RELEASE 有 BOOT-INF、META-INF 和 org 目录基本上从 1.4.0.RELEASE 开始 - 所有的类和库都在 BOOT-INF 目录中.因此,当您尝试在 Amazon Lambda 上运行 Spring Boot 项目时,它说找不到 jar,因为它无法读取新的 Spring Boot Uber jar 结构

Between version 1.3.8.RELEASE of the spring-boot-maven-plugin and version 1.4.0.RELEASE - there has been a change in the generated package structure (if you extract the uber jar file) 1.3.8.RELEASE com, lib, META-INF and org directories 1.4.0.RELEASE has a BOOT-INF, META-INF and org directories Basically from 1.4.0.RELEASE onwards - all the classes and libs are in the BOOT-INF directory. Due to this - when you try to run a Spring Boot project on Amazon Lambda - it says that there is a jar not found as it cannot read the new Spring Boot Uber jar structure

我的问题是 - 是否有可能在较新版本的 Spring Boot Maven 插件中生成与 1.3.9.RELEASE 版本相同结构的 uber jar?

My question is - is it possible in the newer versions of the Spring Boot Maven Plugin to get it to generate the uber jar to be the same structure as in version 1.3.9.RELEASE?

我尝试了 maven-shade-plugin - 但这会导致其他问题

I tried the maven-shade-plugin - but that leads to other issues

非常感谢任何帮助

谢谢达米安

推荐答案

解决方案是在pom.xml文件中为插件添加MODULE布局

The solution was to add the MODULE layout for the plugin in the pom.xml file

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <layout>MODULE</layout>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>repackage</goal>
            </goals>
        </execution>
    </executions>
</plugin>

这篇关于Spring Boot Maven 插件 - 没有 BOOT-INF 目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆