9

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

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

但是,以我的最小示例..我收到“找不到上下文 URL 错误

请注意,我已经指定了所有必需的 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
    }
  }
}
4

1 回答 1

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 元素中再次定义它。

于 2012-11-19T23:55:17.037 回答