Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to publish local android library module to Artifactory

I created a new Android library module inside of my project as a test library. It's a simple module with one class with one static method that returns a string. I have Artifactory server running locally and want to push my Android lib/module to it. I generated the Gradle script and gradle properties from Artifactory web interface. My build.gradle in my testLib module now looks like this:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.1'

}

/////

buildscript {
    repositories {
        maven {
            url 'http://localhost:8081/artifactory/plugins-release'
            credentials {
                username = "${artifactory_user}"
                password = "${artifactory_password}"
            }
        }

    }
    dependencies {
        //Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory
        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.1.1"
    }
}

allprojects {
    apply plugin: "com.jfrog.artifactory"

}

artifactory {
    contextUrl = "${artifactory_contextUrl}"   //The base Artifactory URL if not overridden by the publisher/resolver
    publish {
        repository {
            repoKey = 'libs-release-local'
            username = "${artifactory_user}"
            password = "${artifactory_password}"
            maven = true

        }
    }
    resolve {
        repository {
            repoKey = 'libs-release'
            username = "${artifactory_user}"
            password = "${artifactory_password}"
            maven = true

        }
    }
}

After I added that, I ran the ./gradlew artifactoryPublish command. It says BUILD SUCCESSFUL. I then go to artifactory web app to the repository browser and I look under libs-release-local and it has an artifact count of 0. What am I doing wrong?

like image 608
EGHDK Avatar asked Aug 24 '15 17:08

EGHDK


People also ask

How do I publish to Artifactory?

Go to the artifact browser, select the repository you want to upload to, and hit the Set Me Up button for instructions. You can upload a file using Artifactory UI. Go to the artifact browser, select the repository you want to upload to, and hit the Upload button for instructions.

How do I add a library project to Android Studio?

Navigate to File > Project Structure > Dependencies. In the Declared Dependencies tab, click and select Library Dependency in the dropdown. In the Add Library Dependency dialog, use the search box to find the library to add.


1 Answers

Found a working example here: http://jeroenmols.github.io/blog/2015/08/06/artifactory/

like image 89
EGHDK Avatar answered Sep 22 '22 13:09

EGHDK