Remove development-only dependencies from native image classpath
Fixes gh-32843
This commit is contained in:
@@ -94,6 +94,13 @@ class NativeImagePluginActionIntegrationTests {
|
||||
assertThat(result.getOutput()).contains("paketobuildpacks/builder:tiny").contains("BP_NATIVE_IMAGE = true");
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void developmentOnlyDependenciesDoNotAppearInNativeImageClasspath() {
|
||||
writeDummySpringApplicationAotProcessorMainClass();
|
||||
BuildResult result = this.gradleBuild.build("checkNativeImageClasspath");
|
||||
assertThat(result.getOutput()).doesNotContain("commons-lang");
|
||||
}
|
||||
|
||||
private void writeDummySpringApplicationAotProcessorMainClass() {
|
||||
File examplePackage = new File(this.gradleBuild.getProjectDir(), "src/main/java/org/springframework/boot");
|
||||
examplePackage.mkdirs();
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
plugins {
|
||||
id 'org.springframework.boot' version '{version}'
|
||||
id 'java'
|
||||
}
|
||||
|
||||
apply plugin: 'org.graalvm.buildtools.native'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
developmentOnly("org.apache.commons:commons-lang3:3.12.0")
|
||||
}
|
||||
|
||||
task('checkNativeImageClasspath') {
|
||||
doFirst {
|
||||
tasks.nativeCompile.options.get().classpath.each { println it }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user