Grails

Can't use GStrings for dependencies in BuildConfig.groovy

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Duplicate
  • Affects Version/s: 1.2 final
  • Fix Version/s: 1.2.1
  • Component/s: Configuration
  • Labels:
    None

Description

Take the following extract of BuildConfig.groovy where I want to somehow externalize the version of CXF:

cxfVersion = '2.2.4'
dependencies {
compile "org.apache.cxf:cxf-rt-core:${cxfVersion}"
}


If you do a "grails clean" you'll see an exception like:
WARNING: There was an error loading the BuildConfig: No signature of method: org.codehaus.groovy.grails.resolve.IvyDependencyManager.compile() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl) values: [org.apache.cxf:cxf-rt-core:2.2.4]
groovy.lang.MissingMethodException: No signature of method: org.codehaus.groovy.grails.resolve.IvyDependencyManager.compile() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl) values: [org.apache.cxf:cxf-rt-core:2.2.4]

The workaround is to use toString() like this:
compile "org.apache.cxf:cxf-rt-core:${cxfVersion}".toString()

However that solution is not very elegant

Activity

Hide
Graeme Rocher added a comment -

duplicates GRAILS-5776

Show
Graeme Rocher added a comment - duplicates GRAILS-5776

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: