jdaugherty commented on issue #15129:
URL: https://github.com/apache/grails-core/issues/15129#issuecomment-3487670669
Just some more background here, it looks like when I fixed ear exploded in
Grails 7 (I did have to adjust your example), the actual source files are now
being passed instead of the jar file. This is great news except when it's
processing the resource directory, it's stripping the 'main' directory due to
the aforementioned createRelative behavior.
Using your example application: when processing this URL
[file:/myProjectPath/app/test/build/resources/main], the createRelative method
is stripping the 'main' directory. From what I can tell, the exploded behavior
in Grails 6 does not correctly pass the source files. Instead, it refers to
the jar file which goes through a different path. This is why I can't
reproduce this in Grails 6.
I looked at the implementation of UrlResource#createRelative, and noticed
that originally it had this implementation:
@Override
public Resource createRelative(String relativePath) throws
MalformedURLException {
if (relativePath.startsWith("/")) {
relativePath = relativePath.substring(1);
}
return new UrlResource(new URL(this.url, relativePath));
}
Specifically, this code:
new URL(this.url, relativePath)
Executing this code with the input above (relativePath is an empty string in
this case), it returns a url with the same value.
https://github.com/spring-projects/spring-framework/issues/23532 was the ticket
that changed this behavior in Spring. My guess is Grails was using this in a
different way? I'm some what surprised this hasn't been reported to Spring
upstream.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]