How to convert bootRepackage task to kotlin DSL in gradle 5.0.0?

Clement :

Looking to create a spring boot fat jar, but unsure how to convert the bootRepackage task found here in my build.kts file:

bootRepackage {
    mainClass = 'demo.Application'
}
Clement :

New day, new discovery. Spring Boot docs show that the bootRepackage task has been replaced by bootJar in 2017 and the bootJar task comes out of the box with the spring boot gradle plugin.

The bootRepackage task has been replaced with bootJar and bootWar tasks for building executable jars and wars respectively

build.gradle.kts

// option 1
tasks {
    getByName<BootJar>("bootJar") {
        classifier = "boot"
        mainClassName = "com.example.Application"
    }
}

// option 2
tasks.getByName<BootJar>("bootJar") {
    classifier = "boot"
    mainClassName = "com.example.Application"
}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=101470&siteId=1