Gradle artifactory 插件无法解决对配置阶段的依赖

标签 gradle artifactory

我正在尝试使用 artifactory gradle 插件解决配置阶段的依赖关系。

apply plugin: 'java'
apply plugin: 'com.jfrog.artifactory'

artifactory {
  contextUrl = "${artifactory_contextUrl}"
  ...
  resolve {
    repository {
      repoKey = 'repo'
      username = "${artifactory_user}"
      password = "${artifactory_password}"
      maven = true
    }
  }
}

dependencies {
  compile 'commons-lang:commons-lang:+'
}

task testCustomResolve {
  logger.quiet configurations.getByName('compile').singleFile.absolutePath
}

它给了我

Could not resolve all dependencies for configuration ':compile'. Cannot resolve external dependency commons-lang:commons-lang:+ because no repositories are defined.



它在执行阶段是一种魅力
task testCustomResolve << {
  logger.quiet configurations.getByName('compile').singleFile.absolutePath
}

或者当我使用 mavenCentral()
repositories {
  mavenCentral()
}

最佳答案

如果您不需要发布到 Artifactory,我注意到如果您不使用 artifactory {} 效果会更好。句法。相反,请尝试使用:

plugins {
    id "com.jfrog.artifactory" version "4.4.10"
}

repositories {
    mavenLocal()
    maven {
        url "${artifactory_contextUrl}/${artifactory_repo}"
        credentials {
            username = "${artifactory_user}"
            password = "${artifactory_password}"
        }
    }
    mavenCentral()
}

关于Gradle artifactory 插件无法解决对配置阶段的依赖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27692607/

相关文章:

cordova - Cordova 建立失败

Android - 根据口味更改应用程序版本名称

docker - 拉人工 docker 图像

bamboo - 将快照从 Bamboo 部署到 Artifactory 时遇到问题

artifactory - 从 Jfrog Artifactory OSS 中清理旧 Artifactory

nginx - 推送到 Artifactory Docker 存储库时未实现 501

android - 通过gradle创建Android项目的zip及其依赖项

Grails 3 : External Logback. 常规文件

java - Android 在运行时检查依赖项可用性

java - 将 SNAPSHOT 部署到 oss.jfrog.org (JCenter)