上下文URL不能为空 - Artifactory Gradle Plugin

时间:2012-04-04 18:41:57

标签: gradle artifactory

我正在尝试使用Artifactory Gradle插件工作以发布到我当地的Artifactory实例。

我有在localhost:8081 / artifactory上运行的最新版本(默认安装)。我可以通过webbrowser访问来验证这一点。

然而,用我最简单的例子..我得到一个“无法找到上下文网址错误

请注意,我已指定了所有必需的Artifactory配置设置 - (如Artifactory Gradle WebPage中所示)..包括上下文URL。

buildscript {
  repositories{ maven { url 'http://repo.jfrog.org/artifactory/gradle-plugins' } }
  dependencies{ classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:2.0.12'}
}

apply plugin: 'artifactory'

artifactory {
  contextUrl = 'http://localhost:8081/artifactory'   //The base Artifactory URL if not overridden by the publisher/resolver
  publish {
    repository {
      repoKey = 'integration-libs'   //The Artifactory repository key to publish to
      username = 'admin'          //The publisher user name
      password = 'password'
    } 
  }
  resolve {
    repository {
      repoKey = 'libs-releases'  //The Artifactory (preferably virtual) repository key to resolve from
    }
  }
}

1 个答案:

答案 0 :(得分:5)

这看起来像一个奇怪的错误,我不知道是什么导致它。我在我的一些gradle构建文件中得到它,但其他人似乎工作正常。 我通过在publish元素中再次定义contextUrl来修复它,所以你的脚本现在看起来像:

artifactory {
  contextUrl = 'http://localhost:8081/artifactory'   //The base Artifactory URL if not overridden by the publisher/resolver
  publish {
    contextUrl = 'http://localhost:8081/artifactory' // <- this is the fix
    repository {
      repoKey = 'integration-libs'   //The Artifactory repository key to publish to
      username = 'admin'          //The publisher user name
      password = 'password'
    } 
  }
  resolve {
    repository {
      repoKey = 'libs-releases'  //The Artifactory (preferably virtual) repository key to resolve from
    }
  }
}

您可能还必须在resolve元素中再次定义它。