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

标签 gradle

这是我的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)

最佳答案

plugins DSL具有此处Plugins DSL - Constraine syntax描述的一些限制:您不能使用变量来设置版本。

The form is:

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

Where «plugin id» and «plugin version» must be constant, literal, strings



您应按以下方式应用此插件:
plugins {
    id "com.github.ben-manes.versions" version "0.20.0"
}

关于gradle - 在以下任何来源中均未找到插件[id: 'com.github.ben-manes.versions'],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53818832/

相关文章:

java - 自定义 Gradle 任务类使用哪种语言?

android - 使用 Gradle 构建 Android Studio 项目

android - Jenkins构建在更新gradle后失败

Android Studio 1.0 在 dexDebug 或 dexRelease 构建失败

eclipse - 如何在Eclipse中创建 “New Gradle Project”

repository - Gradle脚本在Maven仓库之间移动工件

android - Gradle 与 Travis CI 在 Android 项目上的依赖关系

android - 在 Android Studio 中将 Holoeverywhere 添加到项目中

intellij-idea - 在 gradle 项目和 IntelliJ IDEA 项目中同步更改运行非常缓慢

java - Log4j 在测试类中不起作用