首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Artifactory虚拟存储库无法解决Gradle-Artifactory插件。

Artifactory虚拟存储库无法解决Gradle-Artifactory插件。
EN

Stack Overflow用户
提问于 2013-07-08 02:10:21
回答 2查看 15.2K关注 0票数 5

因此,我在我的智慧结束时,试图获得构建信息提取器-gradle插件到work...sorry发泄。;-)

我正在使用gradle包装器,指定gradle 1.6,artifactory 3.0.0,并试图指定对build提取器- gradle插件2.1.x-快照的依赖,因为这是gradle 1.5及以上版本的指定版本

我试图遵循这个教程视频,但它必须过时了,因为它仍然引用gradle 1.0并指定jfrog路径,这些路径不包含2.x版本的插件。

艺术装置

  • 本地回购-“分级-发布-本地”-布局设置为分级-默认
  • remote repo - "gradle-plugins“--从jfrog导入中略作修改--例如http://repo.jfrog.org/artifactory/gradle-plugins-snapshots
  • 虚拟回购-“分级”、“分级-发布-本地”和“分级-插件”

分级设置

settings.gradle (由工匠生成)

代码语言:javascript
复制
buildscript {
    repositories {
        maven {
            url 'http://artifactory.build.somewhere.com:8081/artifactory/gradle'
            credentials {
                username = "${artifactory_user}"
                password = "${artifactory_password}"
            }
        }

    }
    dependencies {
        classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:2.1.x-SNAPSHOT'
    }
}

allprojects {
    apply plugin: 'artifactory'
}

artifactory {
    contextUrl = "${artifactory_contextUrl}"   //The base Artifactory URL if not overridden by the publisher/resolver
    publish {
        repository {
            repoKey = 'gradle-release-local'
            username = "${artifactory_user}"
            password = "${artifactory_password}"
            maven = true
            ivy {
                ivyLayout = '[organization]/[module]/ivy-[revision].xml'
                artifactLayout = '[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]'
                mavenCompatible = false
            }
        }
    }
    resolve {
        repository {
            repoKey = 'gradle'
            username = "${artifactory_user}"
            password = "${artifactory_password}"
            maven = true

        }
    }
}

如果我在本地上传jar,我的存储库配置就能工作,例如,这就是我如何下载构建信息提取器-gradle jar的方法。但是,如您所见,所有依赖项都会失败:

代码语言:javascript
复制
    $ gradlew tasks

    FAILURE: Build failed with an exception.

    * What went wrong:
    Could not resolve all dependencies for configuration 'classpath'.
    > Could not find commons-io:commons-io:2.0.1.
      Required by:
          unspecified:unspecified:unspecified > org.jfrog.buildinfo:build-info-extractor-gradle:2.1.x-SNAPSHOT
    > Could not find org.apache.ivy:ivy:2.2.0.
      Required by:
          unspecified:unspecified:unspecified > org.jfrog.buildinfo:build-info-extractor-
...
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

    BUILD FAILED

对于我的梯度配置或手工回购配置有什么问题吗?为什么它不能解决来自远程存储库的外部依赖?我应该添加mavenCentral吗?

更新

我在存储库中添加了mavenCentral(),只是为了看看会发生什么,得到了什么:

代码语言:javascript
复制
$ gradlew tasks
Download http://repo1.maven.org/maven2/commons-io/commons-io/2.0.1/commons-io-2.0.1.pom
Download http://repo1.maven.org/maven2/org/apache/commons/commons-parent/15/commons-parent-15.pom
Download http://repo1.maven.org/maven2/org/apache/ivy/ivy/2.2.0/ivy-2.2.0.pom
Download http://repo1.maven.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.pom
Download http://repo1.maven.org/maven2/org/apache/commons/commons-parent/5/commons-parent-5.pom
Download http://repo1.maven.org/maven2/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.pom

FAILURE: Build failed with an exception.

* What went wrong:
Could not resolve all dependencies for configuration 'classpath'.
> Could not find org.jfrog.buildinfo:build-info-extractor:2.1.x-SNAPSHOT.
  Required by:
      unspecified:unspecified:unspecified > org.jfrog.buildinfo:build-info-extractor-gradle:2.1.x-SNAPSHOT

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

更新#2

重新开始。删除mavenCentral()和本地上传的jar和pom,然后使用--info和-刷新-依赖项运行:

代码语言:javascript
复制
$ gradlew --refresh-dependencies -i tasks
Starting Build
Settings evaluated using empty settings script.
Projects loaded. Root project using build file 'D:\repos\some_build\build.gradle'.
Included projects: [root project 'some_build']
Evaluating root project 'some_build' using build file 'D:\repos\some_build\build.gradle'.
Compiling build file 'D:\repos\some_build\build.gradle' using BuildScriptClasspathScriptTransformer.
Resource missing. [HTTP GET: http://artifactory.build.somewhere.com:8081/artifactory/gradle/org/jfrog/buildinfo/build-info-extractor-gradle/2.1.0/build-info-extractor-gradle-2.1.0.pom]
Resource missing. [HTTP HEAD: http://artifactory.build.somewhere.com:8081/artifactory/gradle/org/jfrog/buildinfo/build-info-extractor-gradle/2.1.0/build-info-extractor-gradle-2.1.0.jar]

FAILURE: Build failed with an exception.

所以,很明显,我的虚拟"gradle“回购并没有找到艺术品。我怎么知道它是否在搜索远程的"gradle-plugins“回购?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2014-01-30 02:31:43

哈!事实证明,有两个非常重要的配置选项,它们是禁用远程存储库解析的,它们是默认选择的(我不记得检查/取消检查这些选项?)。

无论如何,为了最终使分级-手工插件工作,通过使用虚拟回购解决方案,我做了以下工作:

  • 禁用全局脱机模式
    1. 转到:Admin -> Configuration -> General
    2. 确保取消选择全局脱机模式。您将在General Settings中看到此选项
    3. 保存

  • 为虚拟回购启用远程工件解析
    1. 转到:Admin -> Configuration -> Repositories -> {Edit the virtual repo} -> Advanced Settings
    2. 确保虚拟存储库具有Artifactory请求可以检索选择的远程工件
    3. 保存

  • gradle-plugins远程回购添加到虚拟回购中
    1. 在远程存储库中选择New
    2. 为远程回购提供一个名称,如jfrog-gradle-plugins
    3. URL设置为http://repo.jfrog.org/artifactory/gradle-plugins
    4. 保存
    5. 使用jfrog-gradle-plugins选项将Edit远程回购添加到虚拟回购的Selected Repositories
    6. 保存

build.gradle中添加以下内容

代码语言:javascript
复制
buildscript {
    repositories {
        maven {
            url "${repositoryUrl}/libs-release"
        }
    }
    dependencies {
        classpath( group: 'org.jfrog.buildinfo',
                   name: 'build-info-extractor-gradle',
                   version: '2.2.2')
    }
}

gradle.properties中添加以下内容

代码语言:javascript
复制
repositoryUrl = http://my.artifactory.server:8081/artifactory
repositoryUser = me
repositoryPassword = thisIsAPasswordStoredInMyUserDirectory

希望这能帮助那些难以开始集成艺术,艺术Gradle的人。

在Artifactory中调试工件解析的有用提示

使用跟踪 REST选项。例如:

http://repo.jfrog.org/artifactory/gradle-plugins/org/jfrog/buildinfo/build-info-extractor-gradle/2.2.2/build-info-extractor-gradle-2.2.2?trace

票数 6
EN

Stack Overflow用户

发布于 2013-07-08 09:41:28

看起来这些文档是误导的:(对此很抱歉。)我现在补充一份澄清说明。

您正在查看的页面是一个全新的(不同和更好的) artifactory-publish插件的文档,但是在代码中您使用的是经典的artifactory插件(这也很好)。

有关此页插件的文档,请查看artifactory

P.S.非常欢迎您尝试artifactory-publish插件,它太棒了。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17518284

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档