Skip to content
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

Investigate why the Native Build Tools plugin isn't applied in PaketoBuilderTests.nativeApp #42338

Closed
mhalbritter opened this issue Sep 17, 2024 · 1 comment
Assignees
Labels
type: task A general task
Milestone

Comments

@mhalbritter
Copy link
Contributor

mhalbritter commented Sep 17, 2024

spring-boot-system-tests/spring-boot-image-tests/src/systemTest/resources/org/springframework/boot/image/paketo/PaketoBuilderTests-nativeApp.gradle has this snippet:

bootJar {
	manifest {
		attributes(
			'Implementation-Version': '1.0.0',
			'Implementation-Title': 'Paketo Test',
			'Spring-Boot-Native-Processed': 'true'
		)
	}
}

'Spring-Boot-Native-Processed': 'true' shouldn't be necessary, because it is set by our NativeImagePluginAction. However, for reasons unclear to me, the NativeImagePluginAction isn't executed in this build, despite the NBT plugin in the plugins section.

When removing the .withPluginClasspath call in org.springframework.boot.testsupport.gradle.testkit.GradleBuild#prepareRunner, it works. No idea if that is a red herring or not.

@mhalbritter mhalbritter added the type: task A general task label Sep 17, 2024
@mhalbritter mhalbritter added this to the 3.x milestone Sep 17, 2024
@mhalbritter
Copy link
Contributor Author

I stumbled over that while working on #32884.

wilkinsona added a commit to wilkinsona/spring-boot that referenced this issue Sep 17, 2024
When spring-boot-gradle-plugin is using GradleRunner, it needs to be
configured with a custom plugin classpath to account for the fact
that our Gradle plugin is on the classpath of the system classloader
but some of the other plugins would only be available on a
Gradle-created classloader. This imbalance cause class loading
problems as code in spring-boot-gradle-plugin can't see types at
runtime that are only available on the Gradle-created classloader.

To overcome this, we need to configure the GradleRunner with a custom
plugin classpath that contains both spring-boot-gradle-plugin and all
of the other plugins that are used in its various integration tests.
Previously, this was done in GradleBuild that's used by both
spring-boot-gradle-plugin and spring-boot-image-tests. This caused
a problem as spring-boot-image-tests does not have the
above-described problem and trying to correct it did not work leaving
tests that use spring-boot-gradle-plugin unable to see other plugins
such that the native image plugin.

This commit reworks the customization of the plugin classpath so that
it's only done in spring-boot-gradle-plugin's integration tests.

Closes spring-projectsgh-42338
@wilkinsona wilkinsona self-assigned this Sep 18, 2024
@wilkinsona wilkinsona modified the milestones: 3.x, 3.2.x Sep 18, 2024
@wilkinsona wilkinsona modified the milestones: 3.2.x, 3.2.10 Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: task A general task
Projects
None yet
Development

No branches or pull requests

2 participants