Is it possible to use Gradle without specifying a main class? I want to create a library and use gradle to manage my dependencies, and creating a main class doesn't make sense, but I can't seem to find any documents that don't say you need one.
Thanks
Looks like you are using spring-boot gradle plugin to create a library, it maybe call task bootRepackage
to find main class, that throw some error when the main class not found.
Use bootRepackage.enabled
is work for me.
bootRepackage.enabled = false
If you using kotlin DSL like me, try tasks
:
tasks.withType<RepackageTask> {
enabled = false
}
Also:
val bootRepackage by tasks.getting {
enabled = false
}
I am looking for a better answer on the spring boot gradle plugin, but not found temporarily.
Or, we can just use spring-boot-dependencies
with io.spring.dependency-management
, they will not append task bootRepackage
to our projects.
plugins {
id("io.spring.dependency-management")
}
dependencyManagement {
imports { mavenBom("org.springframework.boot:spring-boot-dependencies:X.Y.Z.RELEASE") }
}
But it is not good idea I think.
And, if you want upgrade spring boot version to 2.Y.Z.RELASE
, change bootRepackage
to bootJar
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With