Grails

IvyDomainSpecificLanguageEvaluator.invokeMethod() should accept a GString and List as parameter

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.2 final
  • Fix Version/s: 1.2.1
  • Component/s: Configuration
  • Labels:
    None
  • Environment:
    MBP, OSX Snow Leopard, Java 1.6

Description

I wanted to resolve a list of dependencies without transitive dependency resolution similar to IvyDependencyManager.getDefaultDependencies(). But as IvyDomainSpecificLanguageEvaluator.invokeMethod() does only accept Strings or a Map as first parameter but no GString or List, I always get a MissingMethodException:

class IvyDomainSpecificLanguageEvaluator {
        // [snip]

        def invokeMethod(String name, args) {
                if(!args || !((args[0] instanceof String)||(args[0] instanceof Map)))
                    throw new MissingMethodException(name, IvyDependencyManager, args)
                // ...
        }
        // [snip]
}

I create my own instance of IvyDependencyManager to get some jars/bundles from Maven repos (Spring DM, ...), which are used to create my OSGi environment for the Grails OSGi plugin. I call it like this (from within a Grails script):

def springDMVersion = '2.0.0.M1'
def osgiDependencies = {
	build ("org.springframework.osgi:spring-osgi-core:$springDMVersion",
			"org.springframework.osgi:spring-osgi-extender:$springDMVersion",
			"org.springframework.osgi:spring-osgi-io:$springDMVersion",
			"org.springframework.osgi:spring-osgi-web:$springDMVersion",
			"org.springframework.osgi:spring-osgi-web-extender:$springDMVersion") {
		transitive = false
	}
}

def manager = new IvyDependencyManager(grailsAppName, grailsAppVersion, grailsSettings)
manager.parseDependencies(osgiDependencies)

// ...

I didn't try to change the code of IvyDomainSpecificLanguageEvaluator.invokeMethod() yet, but it should probably suffice to allow GString and List (and possibly String[] and GString[]) as well:

def invokeMethod(String name, args) {
   if(!args || !((args[0] instanceof String)||(args[0] instanceof Map)||(args[0] instanceof List)))
     throw new MissingMethodException(name, IvyDependencyManager, args)

   // ...
}

If I change my code to

build ("org.springframework.osgi:spring-osgi-core:$springDMVersion".toString(),
		"org.springframework.osgi:spring-osgi-extender:$springDMVersion".toString(),
		...) {
	transitive = false
}

everything works as expected.

I have no idea, why resolving IvyDependencyManager.getDefaultDependencies() works, as this should throw an Exception for the same reason...

My Stacktrace:

Error executing script RunBundle: groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.grails.resolve.IvyDependencyManager.build() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl, _Osgi_groovy$_run_closure1_closure7_closure8) values: [org.springframework.osgi:spring-osgi-core:2.0.0.M1, _Osgi_groovy$_run_closure1_closure7_closure8@41955c3]
gant.TargetExecutionException: groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.grails.resolve.IvyDependencyManager.build() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl, _Osgi_groovy$_run_closure1_closure7_closure8) values: [org.springframework.osgi:spring-osgi-core:2.0.0.M1, _Osgi_groovy$_run_closure1_closure7_closure8@41955c3]
at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:331)
at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334)
at gant.Gant$_dispatch_closure6.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:344)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:334)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.processTargets(Gant.groovy:495)
at gant.Gant.processTargets(Gant.groovy:480)
Caused by: groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.grails.resolve.IvyDependencyManager.build() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl, _Osgi_groovy$_run_closure1_closure7_closure8) values: [org.springframework.osgi:spring-osgi-core:2.0.0.M1, _Osgi_groovy$_run_closure1_closure7_closure8@41955c3]
at _Osgi_groovy$_run_closure1_closure7.doCall(_Osgi_groovy:127)
at _Osgi_groovy$_run_closure1_closure7.doCall(_Osgi_groovy)
at _Osgi_groovy$_run_closure1.doCall(_Osgi_groovy:121)
at _Osgi_groovy$_run_closure1.doCall(_Osgi_groovy)
at _Osgi_groovy$_run_closure3.doCall(_Osgi_groovy:219)
at RunBundle$_run_closure1.doCall(RunBundle:10)
at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324)
... 10 more
Error executing script RunBundle: groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.grails.resolve.IvyDependencyManager.build() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl, _Osgi_groovy$_run_closure1_closure7_closure8) values: [org.springframework.osgi:spring-osgi-core:2.0.0.M1, _Osgi_groovy$_run_closure1_closure7_closure8@41955c3]

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: