gradlew getResource bug?

99 views
Skip to first unread message

Pablo Vidaurri

unread,
Aug 21, 2020, 12:13:36 AM8/21/20
to cas-...@apereo.org
Using CAS 6.2 template and using the following command to overlay the message.properties file:
gradlew getResource -PresourceName=messages.properties

The file does not get copied into my src/main/resources folder. This is the output of the command:
> Task :getResource
Copied file D:\workspaces\Spring_Workspace\cas-overlay-template\build\cas-resources\messages.properties to D:\workspaces\Spring_Workspace\cas-overlay-template\build\cas-resources\messages.properties

the From and To paths are the same. Is this a bug?
-psv

Pablo Vidaurri

unread,
Aug 25, 2020, 1:56:17 AM8/25/20
to cas-...@apereo.org
It looks like an issue from tasks.gradle and the path separators:
projects\cas-overlay-template\build/cas-resources
which causes string mismatch with
def toResourceFile = resourceFile.replace(fromFile, resourcesDir)  

I added/modified to the task.gradle file getResource function:
 def resourcesDir = "${projectDir}/src/main/resources"
 def fileName = results[0].name
 def toResourceFile = "${resourcesDir}/${fileName}"

Now it executes and places resource in project/src/main/resource

Not sure if this is the correct solution or not. I also expected if I overlaid static/image/cas-logo that it would place in the appropriate src/resources folder but that is not the case

-psv

Andrew Marker

unread,
May 28, 2021, 1:50:04 PM5/28/21
to CAS Community, Pablo Vidaurri
I just pulled v6.3 of https://github.com/apereo/cas-overlay-template. on a MAC.

Does this appear to still be an issue. I solved it similarly to what was described here.

`**gradle/tasks.gradle**` - line 300

Replace: 

        def resourcesDir = "src/main/resources"

With:

        def resourcesDir = "${projectDir}/src/main/resources"


I haven't tested very type of resource: I wanted to pull fragments, but it went from not pulling those to working.  
Reply all
Reply to author
Forward
0 new messages