There a few ways to do this.
- Use the map syntax:
ext['slf4j.version'] = '1.7.10'
- Explicitly call the
set()
method:ext { set('slf4j.version', '1.7.10') }
- Put the properties in a gradle.properties file
slf4j.version=1.7.10
Double-quotes with the property syntax ${}
.
compile "org.slf4j:slf4j-api:${slf4jVersion}"
Note, if you end up going with the “dot” syntax you’ll have to do something a bit different. Best to just use the property()
method.
compile "org.slf4j:slf4j-api:${property('slf4j.version')}"