插件 [id: 'com.github.ben-manes.versions'] 在以下任何来源中均未找到



这是我的gradle构建文件,并得到以下错误:-

/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java Library project to get you started.
* For more details take a look at the Java Libraries chapter in the Gradle
* user guide available at https://docs.gradle.org/4.10.2/userguide/java_library_plugin.html
*/
plugins {
// Apply the java-library plugin to add support for Java Library
id 'java-library'
id 'de.fuerstenau.buildconfig' version '1.1.8' apply true
id 'eclipse'
id 'com.github.ben-manes.versions' version '$version'
id 'com.palantir.git-version'
}
dependencies {
classpath(
"gradle.plugin.com.palantir.gradle.gitversion:gradle-git-version:0.5.3",
"com.github.ben-manes:gradle-versions-plugin:0.13.0",
"gradle.plugin.de.fuerstenau:BuildConfigPlugin:1.1.4",
"net.ltgt.gradle:gradle-apt-plugin:0.13",
"com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3",
)
compile(
"com.squareup.okhttp3:okhttp:$versions.okhttp",
"com.google.code.gson:gson:$versions.gson",
)
compileOnly(
"com.google.auto.value:auto-value:$versions.autoValue",
deps.nullityAnnotations,
"com.github.kevinmost.auto-value-custom-hashcode-equals:adapter:$versions.customHashCodeEquals",
)
apt(
"com.google.auto.value:auto-value:$versions.autoValue",
"com.gabrielittner.auto.value:auto-value-with:1.0.0",
"com.github.kevinmost.auto-value-custom-hashcode-equals:processor:$versions.customHashCodeEquals",
)
// This dependency is exported to consumers, that is to say found on their compile classpath.
api 'org.apache.commons:commons-math3:3.6.1'
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation 'com.google.guava:guava:23.0'
// Use JUnit test framework
testImplementation 'junit:junit:4.12'
}
// In this section you declare where to find the dependencies of your project
repositories {
// Use jcenter for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
mavenLocal()    
mavenCentral()
maven { url "https://jitpack.io" }
}
buildConfig {
packageName = "api2"
clsName = "BuildConfig"
}
ext.versions = [
okhttp: "3.4.1",
gson: "2.7",
autoValue: "1.5.2",
slf4j: "1.7.21",
kotlin: "1.0.5-2",
customHashCodeEquals: "db3442d",
]

错误:_

* What went wrong:
Plugin [id: 'com.github.ben-manes.versions'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (plugin dependency must include a version number for this source)

pluginsDSL有一些限制,这里描述了插件DSL-约束语法:不能使用变量来设置版本。

形式为:

plugins { id «plugin id» version «plugin version» [apply «false»] }

其中«插件id»和«插件版本»必须是常量、文字、字符串

您应该按如下方式应用此插件:

plugins {
id "com.github.ben-manes.versions" version "0.20.0"
}

最新更新