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/07 12:07:00 UTC

[jira] [Comment Edited] (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=16858562#comment-16858562 ] 

Paul King edited comment on GROOVY-9160 at 6/7/19 12:06 PM:
------------------------------------------------------------

Okay, things are a little clearer now. When I run this script in the groovyConsole:
{code}
@Grab("io.rest-assured:rest-assured:3.1.0")
@GrabExclude(group = 'org.codehaus.groovy', module = '*')
import java.lang.String

getClass().classLoader.URLs.each{ println it.file }
println System.getProperty('java.class.path')
{code}
It works fine. But without the {{@GrabExclude}} it reports:
{noformat}
Conflicting module versions. Module [groovy-xml is loaded in version 2.5.7 and you are trying to load version 2.4.12
{noformat}
The Groovy artifact is coming in because rest-assured is bringing in groovy and groovy-xml (with version 2.4.12 set for groovy-xml in their parent pom).

What you are saying is that the normal {{@GrabExclude}} behavior is not working for you in the embedded context. Correct?



was (Author: paulk):
Okay, things are a little clearer now. When I run this script in the groovyConsole:
{code}
@Grab("io.rest-assured:rest-assured:3.1.0")
@GrabExclude(group = 'org.codehaus.groovy', module = '*')
import java.lang.String

getClass().classLoader.URLs.each{ println it.file }
println System.getProperty('java.class.path')
{code}
It works fine. But without the {{@GrabExclude}} it reports:
{noformat}
Conflicting module versions. Module [groovy-xml is loaded in version 2.5.7 and you are trying to load version 2.4.12
{noformat}
The Groovy artifact is coming in because rest-assured is bringing in groovy and groovy-xml (with version 2.4.12 set for groovy-xml in their parent pom).

What you are saying is that the normal{{@GrabExclude}} behavior is not working for you in the embedded context. Correct?


> 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: Major
>
> 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)