Depending on specific configurations does not work
I'm writing a library with multiple modules that depend on each other.
My dependencies are set up like this:
dependencies {
debugCompile project(path: ":submodule", configuration: "debug")
releaseCompile project(path: ":submodule", configuration: "release")
}
This results in an empty <dependencies /> tag in the resulting .pom
I tried adding this to all modules' build.gradle:
android {
defaultPublishConfig "release"
publishNonDefault true
}
This might be related to #11 and #32, I'm not sure but is there anything I can do about this?
I believe the problem comes from https://github.com/dcendents/android-maven-gradle-plugin/blob/master/src/main/java/org/gradle/api/plugins/AndroidMavenPlugin.java#L189
Only the dependencies from the compile configuration is considered. When I tried to add releaseCompile and debugCompile too it sort of works, though I get a duplicate dependency which is also lacking the configuration.
@dcendents Any thoughts on this?
this might be related to #50.
Is your project public so I get look at your configuration?
Not really, but it can be reproduced using a project with two modules with the main module having this:
dependencies {
debugCompile project(path: ":submodule", configuration: "debug")
releaseCompile project(path: ":submodule", configuration: "release")
}
and the submodule this:
android {
defaultPublishConfig "release"
publishNonDefault true
}
The problem is that android-maven-gradle-plugin simply doesn't look for debugCompile and releaseCompile dependencies.
Please read my comment on issue #50 , I feel you are also trying to do something that is not natural in a maven repository.
Maven expects a single set of dependencies for all classifiers. If I include compile, debugCompile, releaseCompile and any other configuration you might define through flavors it will end up with a pom that contains everything, so it will also be wrong.
It's probably safer to keep using compile only, as it is the "default" configuration to use. Then if you have particular needs for a library, you might need to write a custom handler: https://docs.gradle.org/current/userguide/maven_plugin.html#sub:dependency_mapping
Well, releaseCompile might be nice for having different artifacts for debug and release (which is our use case). It would result in two different artifact (one debug and one release) so the same artifact would never conflict.
@ansman is is the plugin or the build that doesn't look for the dependencies? in ticket #50 I reference a bug that apparently impacts this.