Android工作室不向Artifactory发布工件

时间:2017-11-02 14:34:43

标签: android-studio gradle android-gradle artifactory android-studio-3.0

我遇到了Android Studio和Artifactory的奇怪问题。我想从Android Studio发布一个模块。问题是,构建信息发布得很好,但工件没有发布。

的build.gradle

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.5.4"
    }
}

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

    repositories {
        google()
        jcenter()
    }
}

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

artifactory {
    contextUrl = "${artifactory_contextUrl}"
    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
        }
    }
}

模块/的build.gradle

apply plugin: 'com.android.library'
apply plugin: 'maven-publish'

def packageName = 'x.x'
def libraryVersion = 'v1.0.0'

android {
    compileSdkVersion 26

    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 10000
        versionName libraryVersion

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

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

publishing {
    publications {
        aar(MavenPublication) {
            groupId packageName
            version = libraryVersion
            artifactId "y"

            artifact("$buildDir/outputs/aar/$archivesBaseName-release.aar")
        }
    }
}

artifactory {
    publish {
        defaults {
            publications('aar')

            publishArtifacts = true
            publishBuildInfo = false
            publishPom = true
            publishIvy = false
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:support-v4:26.1.0'
    implementation 'com.android.support:design:26.1.0'

    implementation 'com.squareup.okhttp3:okhttp:3.8.1'
    implementation 'com.squareup.okhttp3:logging-interceptor:3.8.1'
    implementation 'com.squareup.retrofit2:retrofit:2.3.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.3.0'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}

当我从终端运行./gradlew assembleRelease artifactoryPublish时,我总是得到以下输出:

> Task :minecommon:artifactoryPublish
Deploying build descriptor to: https://artifactory-domain/artifactory/api/build
Build successfully deployed. Browse it in Artifactory under https://artifactory-domain/artifactory/webapp/builds/project-name/1509633107114


BUILD SUCCESSFUL in 2s
26 actionable tasks: 1 executed, 25 up-to-date

我可以在" Build Browser"中找到构建。我的Artifactory。

我的配置有问题吗?如何让gradle发布我的工件?

我已尝试在此问题上找到的每篇文章都无法解决。

0 个答案:

没有答案