Search code examples
androidmavengradlepublish

Upload external dependencies to local maven repository


I try to use local publishing for my sdk, then compile it in main app project.

So the apply :

apply plugin: 'maven-publish'

with the command ./gradlew publishToMavenLocal

But seems that external dependencies are not uploaded

enter image description here

So build errors appear

enter image description here

full log link

How to handle these external dependencies?

Thanks


Solution

  • Publishing in Gradle will not publish transitive dependencies. Otherwise once new artifact version will be published (e.g. Spring) you will also publish everything with it (e.g. log4j) which is already published and will fail.

    So if you want to compile your project, you have to specify both Maven Local (for your artifact) and Maven Central (for external artifacts) in repositories{} clause:

    repositories {
        mavenLocal()
        mavenCentral()
    }