From cf24d181397bb63ae3bd8569788d98bcc5316403 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 4 Oct 2018 15:49:59 +0100 Subject: [PATCH] Explicity set permissions on files in lib of Boot distribution Previously, only the permissions for the scripts in bin/ were set. The permissions for the files in lib/ were not explicity set, leaving them with the same permissions as the source files in Gradle's cache. This has proven to be a little brittle when building in certain environments, leading to test failures. It also assumes that the file permissions in Gradle's cache will be appropriate for entries in a distribution archive. That may not always be a reasonable assumption to make. To avoid the above-described problems, this commit updates the copy spec that's used to add files to lib/ in the archive so that each file uses 0644 for its permissions. Closes gh-14158 --- .../boot/gradle/plugin/ApplicationPluginAction.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/ApplicationPluginAction.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/ApplicationPluginAction.java index fb4345321b..8894a95ab4 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/ApplicationPluginAction.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/ApplicationPluginAction.java @@ -66,10 +66,11 @@ final class ApplicationPluginAction implements PluginApplicationAction { .fromString(loadResource("/windowsStartScript.txt"))); project.getConfigurations().all((configuration) -> { if ("bootArchives".equals(configuration.getName())) { - distribution.getContents() - .with(project.copySpec().into("lib") - .from((Callable) () -> configuration - .getArtifacts().getFiles())); + CopySpec libCopySpec = project.copySpec().into("lib") + .from((Callable) () -> configuration + .getArtifacts().getFiles()); + libCopySpec.setFileMode(0644); + distribution.getContents().with(libCopySpec); bootStartScripts.setClasspath(configuration.getArtifacts().getFiles()); } });