Refactor build.gradle.kts: reorder plugins, configure bootJar and shadowJar, optimize jar task setup, and update main class attribute.
This commit is contained in:
parent
e947275409
commit
3d868a109d
|
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id("java")
|
id("java")
|
||||||
id("com.github.johnrengelman.shadow") version "8.1.1"
|
|
||||||
id("maven-publish")
|
|
||||||
id("org.springframework.boot") version("3.5.3")
|
id("org.springframework.boot") version("3.5.3")
|
||||||
|
id("io.spring.dependency-management") version "1.1.5"
|
||||||
|
id("maven-publish")
|
||||||
|
id("com.github.johnrengelman.shadow") version "8.1.1"
|
||||||
id("com.github.ben-manes.versions") version "0.52.0"
|
id("com.github.ben-manes.versions") version "0.52.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -34,24 +34,28 @@ tasks {
|
||||||
options.encoding = Charsets.UTF_8.name()
|
options.encoding = Charsets.UTF_8.name()
|
||||||
}
|
}
|
||||||
|
|
||||||
withType<Jar> {
|
bootJar {
|
||||||
|
enabled = false // Disable the bootJar task
|
||||||
|
}
|
||||||
|
|
||||||
|
jar {
|
||||||
|
enabled = true // Enable the jar task
|
||||||
manifest {
|
manifest {
|
||||||
// attributes["Main-Class"] = "BOOT-INF/classes/${rootProject.group}.${project.name}"
|
attributes["Main-Class"] = "com.alttd.AltitudeBot"
|
||||||
attributes["Main-Class"] = "org.springframework.boot.loader.JarLauncher"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
archiveFileName.set(rootProject.name + ".jar")
|
archiveFileName.set(rootProject.name + ".jar")
|
||||||
|
mergeServiceFiles()
|
||||||
manifest {
|
manifest {
|
||||||
attributes["Main-Class"] = "org.springframework.boot.loader.JarLauncher"
|
attributes["Main-Class"] = "com.alttd.AltitudeBot" // Set your main class directly
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
build {
|
build {
|
||||||
dependsOn(shadowJar)
|
dependsOn(shadowJar)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user