-
Notifications
You must be signed in to change notification settings - Fork 40.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The value of a manifest attribute must not be null (Key=Start-Class #10621
Comments
I tried fixing it by adding
To the build.gradle file, but no effect. |
I think your main method is declared at the wrong level. I believe it should be: diff --git a/src/main/kotlin/com/booklist/backend/BackendApplication.kt b/src/main/kotlin/com/booklist/backend/BackendApplication.kt
index f6efae2..bea523b 100644
--- a/src/main/kotlin/com/booklist/backend/BackendApplication.kt
+++ b/src/main/kotlin/com/booklist/backend/BackendApplication.kt
@@ -16,16 +16,15 @@ import javax.persistence.Id
@SpringBootApplication
class BackendApplication {
- fun main(args: Array<String>) {
- SpringApplication.run(BackendApplication::class.java, *args)
- }
-
@Bean
fun startup(userService: UserService) = CommandLineRunner {
userService.register("erik", "erik@gmail.com")
}
+}
+fun main(args: Array<String>) {
+ SpringApplication.run(BackendApplication::class.java, *args)
}
@RestController With this change in place I can build the fat jar and run it with And, just for the record, setting |
I should also have said that I defer to @sdeleuze for all things Kotlin, and the change I've proposed above brings things into line with the main class in his Spring Boot Kotlin demo. |
Hi @wilkinsona , thanks for that, you're right! I've checked it, just to be sure, with Josh' app here: https://github.com/joshlong/flux-flix-service/blob/master/kotlin/flux-flix-service/src/main/kotlin/com/example/fluxflixservice/FluxFlixServiceApplication.kt, and same. Cheers! |
Yeah that's the setup I recommend and that we use on our examples and on start.spring.io. As an alternative, it is possible to declare the
So probably better to use top level Also see #10511 which will provide an even better syntax in |
Ah, thanks for that, I'll have a look at #10511 too. |
kotlinVersion = '1.1.51'
springBootVersion = '2.0.0.M5'
javaVersion = '9'
gradleVersion = 4.2.1
Bug report
Running a ./gradlew clean build results in the following error:
For a simple project to reproduce: https://github.com/bodiam/booklist
The text was updated successfully, but these errors were encountered: