因此,我在我的智慧结束时,试图获得构建信息提取器-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版本的插件。
艺术装置
分级设置
settings.gradle (由工匠生成)
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的方法。但是,如您所见,所有依赖项都会失败:
$ 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(),只是为了看看会发生什么,得到了什么:
$ 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和-刷新-依赖项运行:
$ 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“回购?
发布于 2014-01-30 02:31:43
哈!事实证明,有两个非常重要的配置选项,它们是禁用远程存储库解析的,它们是默认选择的(我不记得检查/取消检查这些选项?)。
无论如何,为了最终使分级-手工插件工作,通过使用虚拟回购解决方案,我做了以下工作:
Admin -> Configuration -> GeneralGeneral Settings中看到此选项
Admin -> Configuration -> Repositories -> {Edit the virtual repo} -> Advanced Settings
gradle-plugins远程回购添加到虚拟回购中Newjfrog-gradle-pluginsURL设置为http://repo.jfrog.org/artifactory/gradle-pluginsjfrog-gradle-plugins选项将Edit远程回购添加到虚拟回购的Selected Repositories中
向build.gradle中添加以下内容
buildscript {
repositories {
maven {
url "${repositoryUrl}/libs-release"
}
}
dependencies {
classpath( group: 'org.jfrog.buildinfo',
name: 'build-info-extractor-gradle',
version: '2.2.2')
}
}向gradle.properties中添加以下内容
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
发布于 2013-07-08 09:41:28
看起来这些文档是误导的:(对此很抱歉。)我现在补充一份澄清说明。
您正在查看的页面是一个全新的(不同和更好的) artifactory-publish插件的文档,但是在代码中您使用的是经典的artifactory插件(这也很好)。
有关此页插件的文档,请查看artifactory。
P.S.非常欢迎您尝试artifactory-publish插件,它太棒了。
https://stackoverflow.com/questions/17518284
复制相似问题