所以,我想尽办法让 build-info-extractor-gradle 插件工作......抱歉发泄。;-)
我正在使用 gradle 包装器,指定 gradle 1.6、artifactory 3.0.0,并尝试指定对 build-info-extractor-gradle 插件 2.1.x-SNAPSHOT 的依赖,因为这是gradle 1.5 及更高版本的指定版本.
我试图按照这个教程视频,但它必须是过时的,因为它仍然引用 gradle 1.0 并指定不包含 2.x 版本的插件的 jfrog repo 路径。
工件设置
- 本地仓库 - “gradle-release-local” - 布局设置为 gradle-default
- 远程仓库 - “gradle-plugins” - 从 jfrog 导入稍微修改 - 例如http://repo.jfrog.org/artifactory/gradle-plugins-snapshots
- 虚拟仓库 - “gradle” - “gradle-release-local” 和 “gradle-plugins”
摇篮设置
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,我的存储库配置确实有效,例如,这就是我下载 build-info-extractor-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
关于我的 gradle 配置或我的工件 repo 配置有什么问题的任何想法?为什么它不能解决来自远程存储库的外部依赖关系?我应该只添加 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 和 --refresh-dependencies 运行:
$ 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”存储库?