Eclipse Gradle人造插件错误
我的gradle版本是2.2.1 我正在尝试使用gradle中的artifactory插件(Eclipse Gradle人造插件错误,eclipse,gradle,artifactory,Eclipse,Gradle,Artifactory,我的gradle版本是2.2.1 我正在尝试使用gradle中的artifactory插件(apply plugin:'artifactory') 这是我的代码: buildscript { repositories { maven { url 'http://172.14.3.93/artifactory/plugins-release' } } dependencies { classpath
apply plugin:'artifactory'
)
这是我的代码:
buildscript {
repositories {
maven {
url 'http://172.14.3.93/artifactory/plugins-release'
}
}
dependencies {
classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.0.9')
}
}
allprojects {
apply plugin: 'artifactory'
}
artifactory {
contextUrl = "${artifactory_contextUrl}" //The base Artifactory URL if not overridden by the publisher/resolver
publish {
repository {
repoKey = 'libs-release-local'
maven = true
}
}
resolve {
repository {
repoKey = 'libs-release'
maven = true
}
}
}
当我运行gradle build时,我得到的是:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Workspace\GradleConfiguration\build.gradle' line: 100
* What went wrong:
A problem occurred evaluating root project 'GradleConfiguration'.
> Failed to apply plugin [id 'artifactory']
> Could not find method add() for arguments [artifactoryPublish, class org.jfrog.gradle.plugin.artifactory.extractor.BuildInfoTask] on task set.
* Try:
Run with --info or --debug option to get more log output.
另外,当我删除与artifactory相关的所有代码并只保留apply plugin:'artifactory'
,我会得到以下错误:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\OnRights_Workspace\GradleConfiguration\build.gradle' line: 86
* What went wrong:
A problem occurred evaluating root project 'GradleConfiguration'.
> Failed to apply plugin [id 'artifactory']
> Plugin with id 'artifactory' not found.
* Try:
Run with --info or --debug option to get more log output.
buildscript
块告诉Gradle应该在哪里寻找插件。您已经告诉它,它应该只在以下位置搜索
您是否100%确定“artifactory”插件实际上托管在那里
如果你把jcenter放在那里,比如,它工作得更好吗
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.1.0"
}
}
apply plugin: "com.jfrog.artifactory"
你的插件版本太旧了。尝试使用最新的()。正如我所说的,即使我删除了构建脚本并只保留应用插件,错误仍然存在。这是意料之中的。请不要删除
buildscript
块,Gradle需要它才能找到插件。只需准确地添加说明内容,并让我们知道这是可行的。我链接的页面中的整个块,标题为“构建脚本片段以在所有Gradle版本中使用”。您也可以尝试另一个名为“在Gradle 2.1及以上版本中使用的构建脚本片段”。我不明白为什么在artifactory站点生成的构建脚本中,默认情况下它会告诉Gradle在artifactory中查找插件……好的,我升级了,我的问题是,升级后是否需要删除jcenter()存储库?我目前正在使用mavenCentral()和Artifactory如果您将Artifactory与插件一起使用,您应该在buildscript{}
中拥有jcenter
,并且脚本本身中根本没有存储库。该插件负责解析和部署。在撰写本文时(一年前),当前版本为“4.4.2”,最新版本为3.1.1。是的,我们正在工作:)