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

vic*_*csz 8 artifactory gradle

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

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

但是,用我最简单的例子..我得到一个" 无法找到上下文URL错误

请注意,我已指定所有必需的Artifactory配置设置 - (如Artifactory Gradle WebPage上所示)..包括Context 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
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

小智 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
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

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