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

Grapes cannot GrabExclude transitive dependencies when they are groovy

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.5.7
    • None
    • Grape
    • None

    Description

      Hi,

      We use Groovy 2.5.7 and run a script with the following Grapes:

      @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 = '*')
      ])

      But this does not correctly exclude groovy transitive dependencies (others are excluded fine) and generates this error:

      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)

      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.

      @Grab("org.codehaus.groovy:groovy:2.5.7"),
      @Grab("org.codehaus.groovy:groovy-xml:2.5.7")

      Thank you.

      Attachments

        Activity

          People

            Unassigned Unassigned
            eduramiba Eduardo Ramos
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: