Managing dependency with AND without classifier


(dalewking) #1

Have an android app that uses the android-jodatime library:

"net.danlew:android.joda:2.9.4.1:"

This has a transitive dependency on this library

'joda-time:joda-time:2.9.4:no-tzdb'

Which is the same as the non-qualified version except some files are excluded from the jar, because their functionality is provided in a different way for Android by the android joda plugin.

That works fine for running the app, but for unit testing I want to use the version of the joda-time plugin without the the no-tzdb qualifier, but I can’t seem to get Gradle to support that.

I have this declaration:

testCompile(group:"joda-time", name:'joda-time', version:'2.9.4', classifier: '') {force = true}

But gradle keeps only using the no-tzdb version of the artifact that it got as a transitive dependency.


(dalewking) #2

OK, never mind. it seems to be working fine now. I was seeing problems due to this when running unit tests in Android Studio, so I tried in command line gradle and it worked fine and now it even seems to work fine in Android Studio. Maybe, I just need to do a gradle sync.