【问题标题】:Why is Gradle looking in the wrong place for my plugin?为什么 Gradle 在错误的位置寻找我的插件?
【发布时间】:2020-08-06 06:32:37
【问题描述】:

在我的 build.gradle 文件的顶部我放了这个:

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

下面我尝试应用插件,但这没关系,因为它没有在本地 maven 存储库中寻找正确的工件。我得到了这个错误:

* 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) 它从完全不同的工件描述符中查找:

'tdk-core-gradle-plugin:tdk-core-gradle-plugin.gradle.plugin:1.0

比我明确指定的那个:

com.telenav.tdk.core.gradle:tdk-core-gradle-plugin:1.0

这对我来说很违反直觉,但我确信有某种解释。 有人知道发生了什么吗?

谢谢,

Jon

【问题讨论】:

    标签: gradle plugins classpath


    【解决方案1】:
    1. 插件存储库 - 了解如何设置 https://docs.gradle.org/current/userguide/plugins.html#sec:plugin_management

      settings.gradle

      插件管理 {
      存储库 {
      }
      }

    2. 插件有两种应用方式,分辨率不同,详见

    DSLhttps://docs.gradle.org/current/userguide/plugins.html#sec:plugin_markers
    构建脚本https://docs.gradle.org/current/userguide/plugins.html#sec:old_plugin_application

    【讨论】:

    • 这很有帮助。谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-01
    • 1970-01-01
    • 2013-06-26
    • 1970-01-01
    • 2011-03-03
    • 1970-01-01
    相关资源
    最近更新 更多