在我的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 {
储存库{
}
}
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/