Can configuration names begin with a capital letter?


(Panu) #1

I’m having problems with configuration names that begin with a capital letter. This example based on the User Guide works as expected:

configurations {
    sealife
}
  dependencies {
    sealife "sea.mammals:orca:1.0", "sea.fish:shark:1.0", "sea.fish:tuna:1.0"
}
  task dependencies << {
    configurations.sealife.dependencies.each { dep -> println dep.name }
}

If I rename “sealife” to “Sealife” like this:

configurations {
    Sealife
}
  dependencies {
    Sealife "sea.mammals:orca:1.0", "sea.fish:shark:1.0", "sea.fish:tuna:1.0"
}
  task dependencies << {
    configurations.Sealife.dependencies.each { dep -> println dep.name }
}

Then it produces error:

build file 'C:\Users\panu_r\Desktop\gradle\nok\build.gradle': 6: unexpected token: sea.mammals:orca:1.0 @ line 6, column 13.
         Sealife "sea.mammals:orca:1.0", "sea.fish:shark:1.0", "sea.fish:tuna:1.0"
                 ^

Should this work? I’m using Gradle version 1.7.


(Peter Niederwieser) #2

It’s unconventional and doesn’t appear to be valid Groovy syntax. (This could be a Groovy bug, but it’s known that Groovy sometimes interprets identifiers that start with a capital letter as a class name. I don’t know the exact rules.) I recommend to stay away from it.