Option for Spring Boot Maven Plugin to place classes in root of JAR, and libraries under lib
directory
#36101
Labels
status: declined
A suggestion or change that we don't feel we should currently apply
The Spring Boot Maven Plugin does an awesome job of zipping up dependency JARs and classes in the current project. However the location it places them needs to be tweaked for certain platforms, specifically AWS Lambda.
This is expressly not a duplicate of #6626. As noted in that ticket:
This ticket is in fact 1) to move the content of
BOOT-INF/classes
into the root of the JAR, and 2) move theBOOT-INF/lib
directory itself to the root of the JAR.I'm using the Spring Boot Maven Plugin with Maven 3.9.1 and Java 17 on Windows 10. If I use
<layout>ZIP</layout>
I get a layout like this:BOOT-INF/classes/
BOOT-INF/classes/com/
BOOT-INF/classes/com/example/
BOOT-INF/classes/com/example/Foo.class
BOOT-INF/lib/
BOOT-INF/lib/foo.jar
BOOT-INF/lib/bar.jar
However in order to deploy a ZIP file to AWS Lambda, we supposedly need a layout something like this (although the layout AWS Lambda requires apparently isn't documented):
com/
com/example/
com/example/Foo.class
lib/
lib/foo.jar
lib/bar.jar
Most of the AWS documentation such as Deploy Java Lambda functions with .zip or JAR file archives simply says to use the Maven Shade Plugin, which is a real mess (forcing the developer to deal with irrelevant clashing text files and the like). Plus it breaks multirelease JARS by forcing multirelease data into the main JAR which AWS Lambda doesn't support.
The output of the Spring Boot Maven Plugin is much nicer—it just needs to be tweaked. Can we an an option to simply relocate the contents of those two subdirectories to a different location?
The text was updated successfully, but these errors were encountered: