I am trying to build an application where it uses a library as a dependency but I do not want the library as part of the final output jar. Much like ‘providedCompile’ in the war plugin, but I am not using the war plugin.
configurations{ XLibConfig }
dependencies {
XLibConfig(group: ‘com.mycompany.xlib’, name: ‘xlib’, version:‘1.4’) } sourceSets.main.compileClasspath += configurations.XLibConfig
During development, I needed to make a change to the XLibConfig. So I made the change, built it, and deployed it to our repo, with a new version number, 1.5. So I made the change in my build.gradle file to pull in 1.5. Now my build is failing, as if it is referencing the old library (1.4). All previous builds using 1.4 were successful. I put in print statements to print all the files in the classpath and the right one (1.5) shows up. What’s even more perplexing is if I change the XLibConfig and hard code it to the actual gradle-cached file, it works: ependencies {
XLibConfig files(’/Users/matts/.gradle/caches/modules-2/files-2.1/com.mycompany.xlib/xlib/1.5/befa91f76d87942297dff6bd4c2f86db9d84cda7/xlib-1.5.jar’) }
Obviously, I can’t hard code a dependency like this. Is this a gradle bug? How do I pull in the right version?
p.s. I’m using Gradle 1.10
Thanks, MattS