Setting springs loaderImplementation to CLASSIC via convention plugin

Hi,

In my convention plugin, I’m trying to switch back to the classic loader implementation of spring using these lines:

tasks.named('bootJar') {
	loaderImplementation = org.springframework.boot.loader.tools.LoaderImplementation.CLASSIC
}

Unfortunately this fails with

> Could not create task ':bootJar'.
   > Could not get unknown property 'org' for task ':bootJar' of type org.springframework.boot.gradle.tasks.bundling.BootJar.

I guess the problem is that it is a reference to class that is not known at that point in time. Is there an easy solution for that?

Maybe try to use an import instead of fully-qualified.

Thanks for your reply.
The solution was not (necessarily) to use the fully qualified import, but to add

	implementation 'org.springframework.boot:spring-boot-loader-tools:3.2.5'

to buildSrc/build.gradle.

Somehow your suggestion lead me into the right direction. I remember trying to add org.springframework.boot:spring-boot-gradle-plugin:3.2.5 to buildSrc/build.gradle before, which just messed everything up.

Thanks!

1 Like