Reputation: 39529
in a library jar deployment I need to mark a dependency as provided - otherwise I get
has an indirect dependency on Android API level BAR, but minSdkVersion for variant 'XYZ' is API level FOO
there seems to be a way with the war plugin, but I found no way to do it with the java plugin
the code/build-script is here: https://github.com/ligi/AndroidHelper
anyone knows a way?
Upvotes: 0
Views: 383
Reputation: 793
That's quite easy, you need to create a new configuration
configurations {
compileOnly
}
than add the dependencies of this configuration to the source sets (otherwise compilation fails)
sourceSets {
main {
compileClasspath += configurations.compileOnly
}
test {
compileClasspath += configurations.compileOnly
}
}
The last thing is to tell your IDE that their is something additional, for example for Idea you have to use this
idea {
module {
scopes.PROVIDED.plus += configurations.compileOnly
}
}
Now you can use the compileOnly
configuration in your dependencies
section as usual
Upvotes: 1