Hey,
When migrated to 2.3.0.RC1 the bootJar that is created by the bootJar task does not longer contains application classes nor Spring Boot ones.
I thought that something was changed because of introduction of the layered Jars but according to the doc:
By default, the bootJar task builds an archive that contains the application’s classes and dependencies in BOOT-INF/classes and BOOT-INF/lib respectively.
Environment: - JDK 14 - Gradle 6.4
Executing:
gradle clean bootJar
java -jar build/lib/****.jar
This gets the error as below which is expected as the classes are not bundled there.
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:109)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
Caused by: java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication
at com.tlt.quantum.registry.RegistrySearchServiceApplication.main(RegistrySearchServiceApplication.java:18)
... 8 more
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:435)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:129)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 9 more
Comment From: wilkinsona
Thanks for the report. This looks like a duplicate of https://github.com/spring-projects/spring-boot/issues/21288. Are you using DevTools?
Comment From: aleksanderlech
Thanks for the report. This looks like a duplicate of #21288. Are you using DevTools?
I am, thank you for the fast response. I did the retest using today's 2.3.0.BUILD-SNAPSHOT and the problem seems to be fixed so we can consider the issue as closed :)
Comment From: snicoll
Thanks for the quick follow-up @aleksanderlech