Fail on bootBuildImage with launch script
This commit adds a check to the support code for the Gradle plugin bootBuildImage task to ensure that the jar file that will be passed to a builder is readable and has a valid directory. This prevents a situation where the jar file cannot be read because it is prepended with a launch script, and the builder does not receive any files to process. Notes have also been added to the Gradle plugin documentation to warn against using a bootJar launchScript configuration and bootBuildImage together, as well as caveats about launchScript that match the Maven plugin documentation. Fixes gh-22223
This commit is contained in:
@@ -126,6 +126,15 @@ class BootBuildImageIntegrationTests {
|
||||
}
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void failsWithLaunchScript() {
|
||||
writeMainClass();
|
||||
writeLongNameResource();
|
||||
BuildResult result = this.gradleBuild.buildAndFail("bootBuildImage");
|
||||
assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.FAILED);
|
||||
assertThat(result.getOutput()).contains("not compatible with buildpacks");
|
||||
}
|
||||
|
||||
@TestTemplate
|
||||
void failsWithBuilderError() {
|
||||
writeMainClass();
|
||||
|
||||
Reference in New Issue
Block a user