External dependency not included after deploy to artifactory

I develop small mvp library with included some dependency like butterknife and glide, but after it is already deployed to my private artifactory, all the dependency is not included with my library, so all the dependency is not resolved in my project when using this library. I am new with this artifactory, is I am missing something?

This is my root build.gradle :

buildscript {
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.2.3'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.0.1"
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
   }
}

allprojects {
  repositories {
    jcenter()
  }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

And this is my build.gradle module :

apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
apply plugin: 'me.tatarka.retrolambda'

def libraryGroupId = 'com.pixilapps.pixilframework'
def libraryArtifactId = 'mvp'
def libraryVersion = '1.0.0'

publishing {
    publications {
        aar(MavenPublication) {
            groupId libraryGroupId
            version libraryVersion
            artifactId libraryArtifactId
            artifact("$buildDir/outputs/aar/${artifactId}-release.aar")
        }
    }
}

artifactory {
    contextUrl = 'http://my.lib.web/artifactory'
    publish {
        repository {
            repoKey = 'libs-release-local'

            username = artifactory_username
            password = artifactory_password
        }
        defaults {
            publications('aar')
            publishArtifacts = true

            properties = ['qa.level': 'basic', 'q.os': 'android', 'dev.team': 'core']
            publishPom = true
        }
    }
}

buildscript {
    repositories {
        mavenCentral()
        jcenter()
    }

    dependencies {
        classpath 'me.tatarka:gradle-retrolambda:3.3.1'
    }
}

repositories {
    mavenCentral()
    jcenter()
    maven { url "https://clojars.org/repo/" }
    maven { url "https://jitpack.io" }
    maven {
        url "https://s3.amazonaws.com/repo.commonsware.com"
    }
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
    maven {
        url "http://dl.bintray.com/glomadrian/maven"
    }
}

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"

    defaultConfig {
        minSdkVersion 17
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8.toString()
        targetCompatibility JavaVersion.VERSION_1_8.toString()
    }
}

dependencies {
    final PLAY_SERVICES_VERSION = '9.6.1'
    final DEXMAKER_VERSION = '1.4'
    final HAMCREST_VERSION = '1.3'
    final ESPRESSO_VERSION = '2.2.1'
    final RUNNER_VERSION = '0.4'
    final AUTO_VALUE_VERSION = '1.3'
    final AUTO_VALUE_GSON_VERSION = '0.4.2'
    final SUPPORT_LIBRARY_VERSION = '25.1.0'
    final RETROFIT_VERSION = '2.1.0'
    final BUTTERKNIFE_VERSION = '7.0.1'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile "com.android.support:appcompat-v7:$SUPPORT_LIBRARY_VERSION"
    compile "com.android.support:recyclerview-v7:$SUPPORT_LIBRARY_VERSION"
    compile "com.android.support:cardview-v7:$SUPPORT_LIBRARY_VERSION"
    compile "com.android.support:support-annotations:$SUPPORT_LIBRARY_VERSION"
    compile "com.squareup.retrofit2:retrofit:$RETROFIT_VERSION"
    compile "com.squareup.retrofit2:converter-gson:$RETROFIT_VERSION"
    compile "com.squareup.retrofit2:adapter-rxjava:$RETROFIT_VERSION"
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile 'io.reactivex:rxandroid:1.2.1'
    compile 'io.reactivex:rxjava:1.1.6'
    compile 'com.jakewharton.timber:timber:4.1.2'
    compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
    compile 'com.squareup.okhttp3:okhttp:3.4.1'
    compile 'com.vistrav:ask:2.4'
    compile "com.jakewharton:butterknife:$BUTTERKNIFE_VERSION"
    compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
    compile 'net.danlew:android.joda:2.9.3.1'
    compile 'com.pixplicity.easyprefs:library:1.7'
}

Upvotes: 1

Views: 1556

Answers (1)

JonasVautherin
JonasVautherin

Reputation: 8043

You can use pom.withXml in your publishing block, as described here (find the official documentation about pom.withXml here).

It will look like something approaching this, I guess:

publishing {
    publications {
        aar(MavenPublication) {
            groupId libraryGroupId
            version = libraryVersion
            artifactId libraryArtifactId
            artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")

            pom.withXml {
                def dependencies = asNode().appendNode('dependencies')
                configurations.getByName("_releaseCompile").getResolvedConfiguration().getFirstLevelModuleDependencies().each {
                    def dependency = dependencies.appendNode('dependency')
                    dependency.appendNode('groupId', it.moduleGroup)
                    dependency.appendNode('artifactId', it.moduleName)
                    dependency.appendNode('version', it.moduleVersion)
                }
            }
        }
    }
}

Upvotes: 6

Related Questions