Allowing the user to define properties with a dot in them?

(Francis Galiegue) #1


It is quite a common idiom that, when you have properties related to one another, you use a “custom namespace” such as:

‘’’ domain.property1 = value1 domain.property2 = value2 ‘’’

Unfortunately, Gradle, as of 1.6, does not allow for it (I have tried sourcing a ‘’ with such values but failed).

It would be really, really nice if Gradle allowed for this. For instance, I upload to Sonatype: I have to define ‘sonatypeUsername’, ‘sonatypePassword’, but what I would like to be able to specify is ‘sonatype.credentials.userName’, ‘sonatype.credentials.password’ or the like.

Is there a plan in store to allow for that type of definitions to be usable from property files, or from ‘project.ext’?

(Peter Niederwieser) #2

It’s already possible, e.g. ‘println property(“”)’ or ‘project.ext[“one.two”] = “foo”’.

(Ulf Gitschthaler) #3

Is it possible to use dot properties in Strings as well, e.g.

dependencies {

compile (


) }

At the moment it’s failing with: > No such property: spring for class: org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler

(Peter Niederwieser) #4

Same deal: ‘“org.springframework:spring-webmvc:${property(‘spring.version’)}”’

(Ulf Gitschthaler) #5

okay, thx!