From 4d05e30e1dc1ad0766e89e39394e8cbd5fccbf6d Mon Sep 17 00:00:00 2001 From: Puneet Behl Date: Tue, 5 Mar 2019 17:43:40 +0530 Subject: [PATCH] #11099 #11266 Resources issues in multi-project build - Gradle 4+ changes resources location to /build/classes/main so updated findRootResourcesURL to handle it. --- .../src/main/groovy/grails/io/IOUtils.groovy | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/grails-bootstrap/src/main/groovy/grails/io/IOUtils.groovy b/grails-bootstrap/src/main/groovy/grails/io/IOUtils.groovy index 7b3637f9faa..62cd87ecbb4 100644 --- a/grails-bootstrap/src/main/groovy/grails/io/IOUtils.groovy +++ b/grails-bootstrap/src/main/groovy/grails/io/IOUtils.groovy @@ -189,7 +189,11 @@ class IOUtils extends SpringIOUtils { if(classRes) { String rootPath = classRes.toString() - pathToClassFile if(rootPath.endsWith(BuildSettings.BUILD_CLASSES_PATH)) { - rootPath = rootPath.replace('/build/classes/', '/build/resources/') + if (BuildSettings.BUILD_CLASSES_PATH == "build/classes/groovy/main" ) { + rootPath = rootPath.replace('/build/classes/groovy/', '/build/resources/') + } else { + rootPath = rootPath.replace('/build/classes/', '/build/resources/') + } } else { rootPath = "$rootPath/" @@ -231,7 +235,11 @@ class IOUtils extends SpringIOUtils { if(classRes) { def rootPath = classRes.toString() - pathToClassFile if(rootPath.endsWith(BuildSettings.BUILD_CLASSES_PATH)) { - rootPath = rootPath.replace('/build/classes/', '/build/resources/') + if (BuildSettings.BUILD_CLASSES_PATH == "build/classes/groovy/main" ) { + rootPath = rootPath.replace('/build/classes/groovy/', '/build/resources/') + } else { + rootPath = rootPath.replace('/build/classes/', '/build/resources/') + } } return new URL("$rootPath$path") }