I have a spring boot application, which is integrated with Gradle. After I executed task instalDist, which create a executable script. I can not run this script, because I'm getting error like:
Error: Could not find or load main class some.package
Caused by: java.lang.ClassNotFoundException: some.package
I can execute jar file, it is no problem. I can also run project by IDE. But I cannot run it with this script after ran the instalDist
build.gradle:
plugins {
id 'application-plugin'
id 'groovy'
id "org.springframework.boot" version "2.3.1.RELEASE"
}
dependencies {
some dependencies ..
}
Btw. I created similar project with same settings and it works corectly, but this doesn't work.
You have to add mainClassName
for the spring boot application.
mainClassName = 'com.example.MySpringBootApplication'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.