Skip to content

Commit

Permalink
insert spring.factories into the main jar
Browse files Browse the repository at this point in the history
  • Loading branch information
siordache committed Feb 28, 2020
1 parent 6964242 commit f158861
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@ repositories {
mavenCentral()
}

configurations {
springAutoConfig { transitive = false }
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
springAutoConfig("org.springframework.boot:spring-boot-autoconfigure")
}

jlink {
Expand All @@ -55,3 +60,18 @@ jlink {
}
forceMerge 'jackson', 'log4j', 'jaxb', 'istack', 'stax'
}

prepareMergedJarsDir.doLast {
// extract META-INF/spring.factories from spring-boot-autoconfigure
copy {
from zipTree(configurations.springAutoConfig.singleFile).matching {
include 'META-INF/spring.factories'
}
into jlinkBasePath
}

// insert META-INF/spring.factories into the main jar
ant.zip(update: "true", destfile: jar.archivePath, keepcompression: true) {
fileset(dir: "$jlinkBasePath", includes: 'META-INF/**')
}
}

0 comments on commit f158861

Please sign in to comment.