From 33b49955470d65986a80864c87ea7a13d520f937 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Basl=C3=A9?= Date: Thu, 20 Apr 2023 16:30:42 +0200 Subject: [PATCH] Fix glob pattern in CheckstyleConventions to be Windows-compatible On windows, the `*` character is not allowed in a directory's name. When trying to append a glob pattern to a `Path` (`path.resolve("**")`), if the underlying `Path.getFileSystem()` is windows then an `InvalidPathException` is thrown. The NoHttp plugin doesn't really need a `Path` but a glob `String`, so this commit uses a simple String concatenation in order to append the wildcard part (with the canonical path separator for good measure). Closes gh-30355 --- .../java/org/springframework/build/CheckstyleConventions.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/buildSrc/src/main/java/org/springframework/build/CheckstyleConventions.java b/buildSrc/src/main/java/org/springframework/build/CheckstyleConventions.java index 1d442ceb428..9f4647e6216 100644 --- a/buildSrc/src/main/java/org/springframework/build/CheckstyleConventions.java +++ b/buildSrc/src/main/java/org/springframework/build/CheckstyleConventions.java @@ -27,6 +27,7 @@ import org.gradle.api.plugins.quality.Checkstyle; import org.gradle.api.plugins.quality.CheckstyleExtension; import org.gradle.api.plugins.quality.CheckstylePlugin; +import java.io.File; import java.nio.file.Path; import java.util.List; @@ -68,7 +69,8 @@ public class CheckstyleConventions { Path rootPath = project.getRootDir().toPath(); Path projectPath = rootPath.relativize(subproject.getProjectDir().toPath()); for (String buildFolder : buildFolders) { - noHttp.getSource().exclude(projectPath.resolve(buildFolder).resolve("**").toString()); + Path innerBuildDir = projectPath.resolve(buildFolder); + noHttp.getSource().exclude(innerBuildDir + File.separator + "**"); } }); }