我正在尝试编写一个名为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我试过再次使用git clone或使用sudo运行它。
然而,这两种方法都不起作用。
这个build 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()
}我期望构建成功。有人遇到过这种情况吗?
发布于 2019-08-30 07:27:36
上述插件org.ajoberstar.grgit被应用了两次。第一次通过新的plugins块应用,第二次通过旧的apply plugin:方法。只要删除行apply plugin: "org.ajoberstar.grgit",错误就会消失。
要通过旧的apply plugin:方法应用插件,需要从buildscript块内的任意存储库解析插件包。这与通过普通的repositories和dependencies块解析项目依赖的方式是一样的。
新的plugins块直接解析来自Gradle插件门户的插件并在相同的步骤中应用它们。
我猜想如何应用于插件的方式被更改为更新的插件,但是删除旧的方法并没有发生。在现有的设置中,插件可能是从本地Gradle缓存中解析出来的,但是在新设置中找不到它。
https://stackoverflow.com/questions/57722140
复制相似问题