Creating distribution with repackaged spring boot jar using gradle application plugin

2.4k views Asked by At

Is there any way to configure gradle's application plugin to include only repackaged spring boot jar (by boot gradle plugin) and other resources (e.g. startup scripts) without other dependencies jars (as they already repackaged by boot gradle plugin)?

1

There are 1 answers

0
qfrank On

With spring-boot-gradle-plugin,here is a build.gradle example:

ext {
    mainClassName = 'com.x.x'
}

springBoot {
    mainClass = 'com.x.x'
    layout = 'ZIP'
}

task generateExecutableJar(type: Jar) {
    appendix = 'boot'
    from sourceSets.main.output
}

task repackage(type: BootRepackage, dependsOn: generateExecutableJar) {
    executable = true
    customConfiguration = 'customDependencies'
    withJarTask = generateExecutableJar
}

configurations {
    customDependencies
}