Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.8.9, 2.2.0
-
Patch
Description
@GrabResolver fails to correctly interpret the root URL values as hrefs when they are relative. This is a long-standing cause of Groovy scripts being unable to be distributed with non-centrally managed dependencies.
While Grape is great when dependencies are in repositories that are independent of the source files that use them, it is often the case that a source file (especially Groovy script files) and it's JAR dependencies are most naturally managed together. This improvement to Grape allows the root attribute of the @GrabResolver annotation to be relative to the source file in which the annotation is used. This is a completely backward-compatible change because these relative URLs are only created when the root value is not already a URL, and without this change a root value that is not a valid URL causes an error when the code is executed.
While being able to distribute an archive containing a Groovy script and its dependencies is nice and the FAQ that prompted this improvement, an even groovier use case for this feature is putting a Groovy script file and it's supporting Maven repository in a shared location and using the remote URL execution feature of the Groovy CLI.