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
- relates to
-
GROOVY-3930 groovyc does not allow multiple annotations of the same type even if Retention Policy is SOURCE
- Closed