You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use assemble task in our CI/CD pipeline to build artifacts. From Spring Boot 2.5.0 jar task generates an additional jar archive which ends with -plain.jar. This breaks builds if you use patterns like *.jar to copy the build archive. To restrict the additional jar creation Spring Boot documentation provides guidance here that we can disable the jar task if we prefer that the plain archive isn’t built at all. This doesn’t play well with nativeCompile task.
The behavior you are seeing is to be expected as nativeCompile uses the jar task as an input. This is done by adding a dependency on the project itself to the nativeImageCompileOnly configuration. When the jar task is disabled, the classpath for nativeCompile is incomplete as none of the project's own classes can be found.
We'll update the documentation to indicate that you should not disable the jar task if you want to build a native image.
As an alternative, if you need the jar task to remain disabled, add the main source set's output as a dependency of the nativeImageCompileOnly configuration:
wilkinsona
changed the title
nativeCompile task fails with Error: Main entry point class <application class> neither found on the classpath nor on the modulepath. when jar task is disabled
Document that the jar task should not be disabled when building a native image
Nov 17, 2022
We use
assemble
task in our CI/CD pipeline to build artifacts. From Spring Boot 2.5.0jar
task generates an additional jar archive which ends with-plain.jar
. This breaks builds if you use patterns like *.jar to copy the build archive. To restrict the additional jar creation Spring Boot documentation provides guidance here that we can disable the jar task if we prefer that the plain archive isn’t built at all. This doesn’t play well with nativeCompile task.To Reproduce
Environment
Sample project
https://github.com/michalkrajcovic/spring-native-plain-archives
Compile
Fails with
The text was updated successfully, but these errors were encountered: