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

Multiple GrabResolvers with Grab don't seem to work, and GrabResolve can't be applied to imports

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7-rc-1
    • 1.7-rc-2
    • Grape
    • None

    Description

      Running the following code:

      @GrabResolver(name='jboss', root='http://repository.jboss.org/maven2')
      @GrabResolver(name='codehaus.snapshot', root='http://snapshots.repository.codehaus.org')
      @Grab(group='org.codehaus.gpars', module='gpars', version='0.9-beta-1')
      import groovyx.gpars.actor.PooledActorGroup
      
      println new PooledActorGroup()

      Gives the following error:

      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      /Users/tyates/Code/Groovy/chat/chatserver.groovy: 3: unable to resolve class groovyx.gpars.actor.PooledActorGroup
       @ line 3, column 1.
         @GrabResolver(name='jboss', root='http://repository.jboss.org/maven2')
         ^
      
      1 error

      If I move the GrabResolvers off to a different member, ie:

      @GrabResolver(name='jboss', root='http://repository.jboss.org/maven2')
      @GrabResolver(name='codehaus.snapshot', root='http://snapshots.repository.codehaus.org')
      def dummy() {}
      @Grab(group='org.codehaus.gpars', module='gpars', version='0.9-beta-1')
      import groovyx.gpars.actor.PooledActorGroup
      
      println new PooledActorGroup()

      Then the error changes to:

      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      /Users/tyates/Code/Groovy/chat/chatserver.groovy: 3: Cannot specify duplicate annotation on the same member : GrabResolver at line: 3 column: 1. File: /Users/tyates/Code/Groovy/chat/chatserver.groovy @ line 3, column 1.
         @GrabResolver(name='jboss', root='http://repository.jboss.org/maven2')
         ^
      
      1 error

      To get this to work, I need to do the following:

      @GrabResolver(name='jboss', root='http://repository.jboss.org/maven2')
      def dummy() {}
      @GrabResolver(name='codehaus.snapshot', root='http://snapshots.repository.codehaus.org')
      def dummy2() {}
      @Grab(group='org.codehaus.gpars', module='gpars', version='0.9-beta-1')
      import groovyx.gpars.actor.PooledActorGroup
      
      println new PooledActorGroup()

      which then gives the output:

      groovyx.gpars.actor.PooledActorGroup@2f2c55e4

      So it seems there may be two problems currently:

      1) You cannot specify multiple GrabResolvers for a single member
      2) You cannot specify GrabResolvers on import statements


      To check that 2 fails, I tried the following:

      @GrabResolver(name='restlet.org', root='http://maven.restlet.org')
      @Grab(group='org.restlet', module='org.restlet', version='1.1.6')
      import org.restlet.data.MediaType
      import org.restlet.resource.StringRepresentation
      
      println new StringRepresentation( "Hi", MediaType.TEXT_PLAIN )

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              tim_yates Tim Yates
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: