Saturday, 5. October 2013
Gradle Dynamic Dependencies Also Use Ivy Syntax10/05/2013
Most build.gradle dependencies I've seen specify them using the standard "+" Gradle syntax:
compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.+'
But if you use the maven-plugin that can generate pom.xml files and upload your project to a Maven repository, this breaks Maven builds because the "1.7.+" is not Maven syntax. You can use this instead:
compile "org.slf4j:slf4j-api:[1.7,1.8)"
This mathematical set range notation does effectively the same thing. It includes all 1.7 versions but stops at 1.8. If you wanted it to include any version above 1.7 (including 2.0, etc.), you'd specify:
compile "org.slf4j:slf4j-api:[1.7,)"
There's a bit more info on the Maven/Ivy dynamic version syntax on Maestro's blog.