gradle - 为什么Gradle在我的插件中找错了位置?

标签 gradle plugins classpath

在我的build.gradle文件的顶部,输入以下内容:

buildscript
{
    repositories 
    {
        mavenLocal()
    }
    dependencies
    {
        classpath(group: 'com.telenav.tdk.core.gradle', name: 'tdk-core-gradle-plugin', version: '1.0')
    }
}

下面我尝试应用该插件,但这没关系,因为它不在本地Maven存储库中寻找合适的 Artifact 。我得到这个错误:
* What went wrong:
Plugin [id: 'tdk-core-gradle-plugin', version: '1.0'] was not found in any of the following sources:

- Gradle Core Plugins (not a core plugin, please see https://docs.gradle.org/6.5.1/userguide/standard_plugins.html for available core plugins)
- Plugin Repositories (could not resolve plugin artifact 'tdk-core-gradle-plugin:tdk-core-gradle-plugin.gradle.plugin:1.0')
  Searched in the following repositories:
    Gradle Central Plugin Repository
我发现这很奇怪,因为(1)它没有搜索我的本地Maven存储库,(2)它是从完全不同的 Artifact 描述符中查找的:
'tdk-core-gradle-plugin:tdk-core-gradle-plugin.gradle.plugin:1.0
比我明确指定的那个要大:
com.telenav.tdk.core.gradle:tdk-core-gradle-plugin:1.0
这对我来说是违反直觉的,但是我敢肯定有某种解释。
任何人都知道发生了什么事吗?
谢谢,
Jon

最佳答案

  • 插件存储库-了解如何设置相同的存储库
    https://docs.gradle.org/current/userguide/plugins.html#sec:plugin_management
    settings.gradle
    pluginManagement {
    储存库{
    }
    }
  • 有2种应用插件的方法,解决方案有所不同,有关详细信息,请参见

  • DSL https://docs.gradle.org/current/userguide/plugins.html#sec:plugin_markers
    buildscript https://docs.gradle.org/current/userguide/plugins.html#sec:old_plugin_application

    关于gradle - 为什么Gradle在我的插件中找错了位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63278021/

    相关文章:

    android - 使用同级目录中的 gradle 构建库

    javascript - 从 jquery 插件打印选定的选项

    android - 找不到com.android.tools.build:gradle:3.6.0-rc01

    android - 在一个 react-native 项目中使用 google map 和 FCM

    android - 我的安卓应用的插件

    xcode - AppCode - UI 设计器插件

    java - Spring 5.1.2 PathMatchingResourcePatternResolver 检测 jar 根目录上的文件

    java - 如何在 gradle 的应用程序插件 'run' 任务的类路径上指定一个额外的文件夹?

    java - 库损坏了类路径?

    gradle - 如何让./gradle build执行其他终端命令