Created
June 23, 2020 21:18
-
-
Save jkuipers/0ec336cb97ae356f60861b11145557d9 to your computer and use it in GitHub Desktop.
Sample of how to configure Spring Boot's layered jar support for multi-module build that includes your own libs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
subprojects { subproject -> | |
// ... | |
plugins.withId('org.springframework.boot') { | |
springBoot { | |
bootJar { | |
layered { | |
// application follows Boot's defaults | |
application { | |
intoLayer("spring-boot-loader") { | |
include "org/springframework/boot/loader/**" | |
} | |
intoLayer("application") | |
} | |
// for dependencies we ensure that our own libraries are put into a separate layer | |
dependencies { | |
intoLayer("libs-dependencies") { | |
include "nl.trifork:*:*" | |
} | |
intoLayer("dependencies") | |
} | |
layerOrder = ["dependencies", "spring-boot-loader", "libs-dependencies", "application"] | |
} | |
} | |
buildInfo { | |
properties { | |
// ensure builds result in the same artifact when nothing's changed: | |
time = null | |
} | |
} | |
} | |
} | |
} |
The Maven plugin provides the same features, but using an external XML config file instead of internal DSL: https://docs.spring.io/spring-boot/docs/2.3.1.RELEASE/maven-plugin/reference/html/#repackage-layers
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do you have any idea if this is possible with maven?