找不到 ID 'org.ajoberstar.grgit'插件



我正在尝试编译一个名为VeinMiner
的开源Minecraft mod。我使用./gradlew build来编译它。
然而它失败了,给我这个理由:

FAILURE: Build failed with an exception.
* Where:
Build file '/home/xxxx/Desktop/VeinMiner/build.gradle' line: 26
* What went wrong:
A problem occurred evaluating root project 'VeinMiner'.
> Plugin with id 'org.ajoberstar.grgit' not found.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 14.778 secs

我试图再次克隆它或在 sudo 中运行它。
但是,这两者都不起作用。

这个构建gradle是这样的:
(它太长了,所以我选择了它的一部分(

buildscript {
repositories {
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
}
}
plugins {
id 'com.matthewprenger.cursegradle' version '1.0.7'
id 'org.ajoberstar.grgit' version '1.3.2'
}
apply plugin: 'forge'
apply plugin: 'maven'
apply plugin: "org.ajoberstar.grgit"
apply plugin: "com.matthewprenger.cursegradle"
ext.git = grgit.open(file('.'))
ext {
configFile = file "build.properties"
revision = git.head().abbreviatedId
depth = git.log().size()
}

我希望建立成功。有没有人遇到过这种情况?

提到的插件org.ajoberstar.grgit应用两次。第一次通过新的plugins块应用,第二次通过旧的apply plugin:方法应用。只需删除行apply plugin: "org.ajoberstar.grgit",错误就会消失。

要通过旧的apply plugin:方法应用插件,需要从buildscript块内的任意存储库解析插件包。这与通过普通repositoriesdependencies块解析项目依赖项的方式相同。

新的plugins块直接从 Gradle 插件门户解析插件,并在同一步骤中应用它们。

我猜如何应用于插件的方式已更改为较新的方式,但是没有删除旧方法。在现有设置中,插件可能已从本地 Gradle 缓存中解析,但在新设置中找不到它。

最新更新