Oleg_Andreych
Oleg_Andreych

Reputation: 73

Creating distribution with repackaged spring boot jar using gradle application plugin

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)?

Upvotes: 2

Views: 2493

Answers (1)

qfrank
qfrank

Reputation: 272

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
}

Upvotes: 1

Related Questions