对类路径上已有的插件的插件请求不得包含版本
我已经在网络上搜索了“插件请求已经在类路径上,必须不包括版本site:stackoverflow.com”,但没有发现任何特别的东西。搜索“插件请求已经在类路径上,不得包含版本”(w/out SO)找到:https://discuss.gradle.org/t/error-plugin-already-on-the-classpath-must-not-include-a-version/31814 我读过答案的地方,例如:
我在Grade插件文档中没有找到任何对此用例的引用。
错误
构建文件 '/Users/username/github/OpCon/app/build.gradle' 行: 4 解析插件时出错 [id: 'com.android.application', 版本: '3.4.1']
类路径上已有插件的插件请求不得包含版本
出现在 中,build.gradle (OpCon):IntelliJ IDEA
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app/build.gradle
:
plugins {
id 'com.android.application' version '3.4.1' apply true
}
... and then other stuff
我不明白,类路径'com.android.tools.build:gradle:3.5.2'似乎不包括'com.android.application'...如果在项目中搜索“类路径”,则只有一次出现。
添加:
有趣的是,在 https://maven.google.com/web/index.html 我可以找到'com.android.tools.build:gradle:3.5.2',但没有'com.android.application'分支。
新增2:我已经下载了(由于某种原因实际上下载了相当多的文件)从这里获取的命令 如何才能在一个命令行中下载特定的Maven工件?
mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:get -DrepoUrl='https://maven.google.com/' -Dartifact='com.android.tools.build:gradle:3.4.1'
在文件管理器中找到路径,并在那里只查看jar内部:com.android.tools.build:gradle
username$ jar tvf /Users/username/.m2/repository/com/android/tools/build/gradle/3.4.1/gradle-3.4.1.jar | grep application
1115 Wed May 01 20:30:18 MSK 2019 com/android/build/gradle/internal/tasks/ApplicationIdWriterTask$applicationIdSupplier$1.class
55 Wed May 01 20:29:18 MSK 2019 META-INF/gradle-plugins/com.android.application.properties
所以在罐子里有一个提及。gradle plugin
com.android.application
META-INF
文件是一个内衬:。com.android.application.properties
implementation-class=com.android.build.gradle.AppPlugin
在 Web 上搜索“实现类 java”,查找有关接口的信息。在wiki https://en.wikipedia.org/wiki/Interface_(Java)中:
Java 编程语言中的接口是一种抽象类型,用于指定类必须实现的行为。
所以 gradle 插件可以是一个接口?我该如何进一步挖掘?