Skip to content

Commit cf24d18

Browse files
committed
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 spring-projectsgh-14158
1 parent 1b10d3f commit cf24d18

File tree

1 file changed

+5
-4
lines changed
  • spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin

1 file changed

+5
-4
lines changed

Diff for: spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/ApplicationPluginAction.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,11 @@ public void execute(Project project) {
6666
.fromString(loadResource("/windowsStartScript.txt")));
6767
project.getConfigurations().all((configuration) -> {
6868
if ("bootArchives".equals(configuration.getName())) {
69-
distribution.getContents()
70-
.with(project.copySpec().into("lib")
71-
.from((Callable<FileCollection>) () -> configuration
72-
.getArtifacts().getFiles()));
69+
CopySpec libCopySpec = project.copySpec().into("lib")
70+
.from((Callable<FileCollection>) () -> configuration
71+
.getArtifacts().getFiles());
72+
libCopySpec.setFileMode(0644);
73+
distribution.getContents().with(libCopySpec);
7374
bootStartScripts.setClasspath(configuration.getArtifacts().getFiles());
7475
}
7576
});

0 commit comments

Comments
 (0)