如何在 gradle 中添加人工库?

How to add artifactory libs inside gradle?

我需要在 gradle(android 应用程序)中配置 artifactory。

我已经把下面所有的脚本都放在里面了 build.gradle:

buildscript {
    repositories {
        jcenter()
        maven {
            url '.../artifactory/plugins-releases'
            credentials {
                username = "${artifactory_user}"
                password = "${artifactory_password}"
            }
        }
    }
    dependencies {    
        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.4.14"    
    }
}

apply plugin: "com.jfrog.artifactory"

allprojects {
    repositories {
        jcenter()
    }
}

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

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

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

        }
    }
}

当我试图从这个工件编译一个库时,我得到这个错误:

Failed to resolve: my-lib:1.0.0

com.jfrog.artifactory 插件用于发布 到人工制品中,而不是用于使用它。如果你想使用它,你需要将它定义为你构建的存储库。

我遇到了类似的问题。对我来说,maven { url "" } 值需要以 "http://" 开头。例如

    maven {
        url 'http://.../artifactory/plugins-releases'
        credentials {
            username = "${artifactory_user}"
            password = "${artifactory_password}"
        }
    }