上下文URL不能为空-Artifactory Gradle插件



我正在尝试使用Artifactory Gradle插件来发布到我的本地Artifactory实例。

我在localhost:8081/artifactory上运行了最新版本(默认安装)。我可以通过网络浏览器访问来验证这一点。

然而,以我最起码的例子。。我收到一个"找不到上下文URL错误

请注意,我已经指定了所有必需的Artifactory配置设置-(如Artifactory Gradle网页上所示)。。包括上下文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
    }
  }
}

这看起来像是一个奇怪的错误,我不确定是什么原因造成的。我在一些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元素中再次定义它。

最新更新