Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-6451

Support repository roots in @GrabResolver should work correctly for relative hrefs

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.8.9, 2.2.0
    • 2.3.0-beta-1
    • Grape
    • 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.

      Attachments

        1. patch-groovy-6451.txt
          4 kB
          James P. White

        Activity

          People

            jimwhite James P. White
            jimwhite James P. White
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: