Spring Boot Maven Plugin - No BOOT-INF directory

Damien picture Damien · Mar 30, 2017 · Viewed 16k times · Source

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

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?

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

Any help is greatly appreciated

Thanks Damien

Answer

Damien picture Damien · Mar 30, 2017

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>