You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2019/06/06 23:08:00 UTC

[jira] [Commented] (GROOVY-9160) Grapes cannot GrabExclude transitive dependencies when they are groovy

    [ https://issues.apache.org/jira/browse/GROOVY-9160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16858157#comment-16858157 ] 

Paul King commented on GROOVY-9160:
-----------------------------------

Can you provide a little more information about how you are running the script. Running this script in a vanilla groovyConsole shows no error:
{code:java}
@Grab("io.rest-assured:rest-assured:3.1.0")
@Grab("io.rest-assured:json-schema-validator:3.1.0")
@Grab("com.jayway.jsonpath:json-path-assert:2.4.0")
@GrabExclude(group = 'org.slf4j', module = '*')
@GrabExclude(group = 'org.codehaus.groovy', module = '*')
import java.lang.String

getClass().classLoader.URLs.each{ println it.file }
println System.getProperty('java.class.path')
{code}
And doesn't show multiple Groovy jars on the classpath.


> Grapes cannot GrabExclude transitive dependencies when they are groovy
> ----------------------------------------------------------------------
>
>                 Key: GROOVY-9160
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9160
>             Project: Groovy
>          Issue Type: Bug
>          Components: Grape
>    Affects Versions: 2.5.7
>            Reporter: Eduardo Ramos
>            Priority: Blocker
>
> Hi,
> We use Groovy 2.5.7 and run a script with the following Grapes:
> {quote}@Grapes([
>  @Grab("io.rest-assured:rest-assured:3.1.0"),
>  @Grab("io.rest-assured:json-schema-validator:3.1.0"),
>  @Grab("com.jayway.jsonpath:json-path-assert:2.4.0"),
> @GrabExclude(group = 'org.slf4j', module = '*'),
> @GrabExclude(group = 'org.codehaus.groovy', module = '*')
>  ])
> {quote}
> But this does not correctly exclude groovy transitive dependencies (others are excluded fine) and generates this error:
> {quote}groovy.lang.GroovyRuntimeException: Conflicting module versions. Module [groovy-xml is loaded in version 2.5.7 and you are trying to load version 2.4.12
>  at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl$DefaultModuleListener.onModule(MetaClassRegistryImpl.java:523)
>  at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromProperties(ExtensionModuleScanner.java:87)
>  at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.registerExtensionModuleFromProperties(MetaClassRegistryImpl.java:169)
>  at groovy.grape.GrapeIvy.processCategoryMethods(GrapeIvy.groovy:340)
>  at groovy.grape.GrapeIvy.grab(GrapeIvy.groovy:288)
>  at groovy.grape.Grape.grab(Grape.java:165)
>  at groovy.grape.GrabAnnotationTransformation.visit(GrabAnnotationTransformation.java:376)
>  at org.codehaus.groovy.transform.ASTTransformationVisitor$3.call(ASTTransformationVisitor.java:318)
>  at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:965)
>  at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:647)
>  at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:623)
>  at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:600)
>  at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:390)
>  at groovy.lang.GroovyClassLoader.access$300(GroovyClassLoader.java:89)
>  at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:330)
>  at groovy.lang.GroovyClassLoader$5.provide(GroovyClassLoader.java:327)
>  at org.codehaus.groovy.runtime.memoize.ConcurrentCommonCache.getAndPut(ConcurrentCommonCache.java:147)
>  at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:325)
>  at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:309)
>  at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:251)
>  at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.getScriptClass(GroovyScriptEngineImpl.java:331)
>  at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:153)
>  at org.codehaus.groovy.jsr223.GroovyScriptEngineImpl.eval(GroovyScriptEngineImpl.java:132)
>  at java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:212)
> {quote}
> The only possible workaround is setting an explicit dependency to the same groovy version we have in Java, but this requires changing the groovy script every time we upgrade groovy in our core.
> {quote}@Grab("org.codehaus.groovy:groovy:2.5.7"),
>  @Grab("org.codehaus.groovy:groovy-xml:2.5.7")
> {quote}
> Thank you.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)