我正试图排除插件的构建脚本中的错误。我能够从IntelliJ内部运行这个想法,但是当我尝试从命令行构建时,我会得到一个异常。
我已经能够将构建脚本减少到最低限度,如下所示:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.6'
}
}
plugins {
id 'java'
id 'org.jetbrains.intellij' version '0.3.12'
id "maven"
id "de.undercouch.download" version "3.2.0"
id "com.google.protobuf" version "0.8.6"
id "idea"
}
当我试图使用这个脚本执行一个构建时,我会得到以下错误:
$ gradle buildPlugin
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/erikengheim/Development/Java/experiment/build.gradle' line: 17
* What went wrong:
An exception occurred applying plugin request [id: 'com.google.protobuf', version: '0.8.6']
> Failed to apply plugin 'com.google.protobuf'.
> Could not create an instance of type com.google.protobuf.gradle.ProtobufSourceDirectorySet.
> 'void org.gradle.api.internal.file.DefaultSourceDirectorySet.<init>(java.lang.String, java.lang.String, org.gradle.api.internal.file.FileResolver, org.gradle.api.internal.file.collections.DirectoryFileTreeFactory)'
如果我只对这句话发表评论的话,我就能让所有这些都发挥作用:
id "com.google.protobuf" version "0.8.6"
我不太熟悉Gradle或Java,所以我不知道如何解释异常的堆栈回溯。
发布于 2022-01-06 09:27:04
根build.gradle.kts
buildscript {
repositories {
mavenLocal()
google()
mavenCentral()
maven(uri("https://jitpack.io"))
}
dependencies {
//...
classpath("com.google.protobuf:protobuf-gradle-plugin:0.8.18")
}
}
应用程序
plugins {
id("com.android.library")
id("kotlin-android")
kotlin("kapt")
id("kotlin-parcelize")
kotlin("plugin.serialization")
id("com.google.protobuf") //remove version
}
删除版本
id "com.google.protobuf"
或者Kotlin DSL
id("com.google.protobuf")
https://stackoverflow.com/questions/64244178
复制相似问题