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

@GrabResolver information is not retained at runtime in compiled class

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.0
    • 2.1.2, 2.2.0-beta-1
    • Grape
    • None

    Description

      @Grab annotations are baked into the .class files and executed when the class is loaded. They break if a custom @GrabResolver is used though because that information is lost. It would make sense to keep it.

      E.g. try and compile this

      @GrabResolver(name='spring-snapshot', root='http://repo.springframework.org/snapshot')
      @GrabConfig(systemClassLoader=true)
      @Grab("org.springframework:spring-context:3.2.2.BOOTSTRAP-SNAPSHOT")
      @GrabExclude("commons-logging:commons-logging")
      @Grab("org.slf4j:jcl-over-slf4j:1.6.1")
      @Grab("org.slf4j:slf4j-jdk14:1.6.1")
      class BootstrapGrapes { 
      }
      

      Then blow away your ~/.groovy/grapes/org.springframework and try and load the class:

      $ mv ~/.groovy/grapes ~/tmp
      $ rm -rf ~/.m2/repository/org/springframework/spring-context
      $ groovysh
      > "BootstrapGrapes" as Class
      ...<bang!>
      

      Attachments

        Activity

          People

            paulk Paul King
            david_syer Dave Syer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: