java Minecraft Forge Mod:gradle任务失败,“无法解析依赖项:minecraftforge:forge:1.19.2-42.0.1:userdev”

rdrgkggo  于 2023-06-28  发布在  Java
关注(0)|答案(1)|浏览(205)

当我运行“./gradlew build”时,我得到错误消息:`FAILURE:生成失败,出现异常。

  • 哪里出错了:配置根项目“flashnpcs”时出现问题。

无法解析依赖项:minecraftforge:forge:1.19.2-42.0.1:userdev

  • 尝试:

使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。使用--scan运行以获得完整的见解。`
我正在使用Visual Studio Code
我试过在build.gradle中更改一堆代码,但似乎没有任何效果。我希望我现在已经完成了我的项目,但有一个错误,我似乎无法修复。
这是我的版本。gradle:

buildscript {
    repositories {
        maven { url = 'https://maven.minecraftforge.net' }
        maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
        maven { url = 'https://plugins.gradle.org/m2/' }
        maven { url = 'https://jitpack.io' }
        mavenCentral()
    }
    dependencies {
        classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1+', changing: true
        classpath 'gradle.plugin.com.github.johnrengelman:shadow:7.1.1'
        classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
    }
}

apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'org.spongepowered.mixin'

group = 'flash'
version = '1.2.0'
archivesBaseName = 'flashnpcs'

java.toolchain.languageVersion = JavaLanguageVersion.of(17)

minecraft {
    mappings channel: 'official', version: "1.19.2"

    accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')

    runs {
        client {
            workingDirectory project.file('run/client')

            property 'forge.logging.markers', 'REGISTRIES'

            property 'forge.logging.console.level', 'debug'

            arg "-mixin.config=flashnpcs.mixins.json"

            mods {
                flashnpcs {
                    source sourceSets.main
                }
            }
        }

        server {
            workingDirectory project.file('run/server')

            property 'forge.logging.markers', 'REGISTRIES'

            property 'forge.logging.console.level', 'debug'

            arg "-mixin.config=flashnpcs.mixins.json"

            mods {
                flashnpcs {
                    source sourceSets.main
                }
            }
        }
    }
}

mixin {
    config "flashnpcs.mixins.json"
    add sourceSets.main, "flashnpcs.refmap.json"

    showMessageTypes = true
}

sourceSets.main.resources { srcDir 'src/generated/resources' }

dependencies {
    minecraft 'net.minecraftforge:forge:1.19.2-42.0.1'


    annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'

//    FOR SOME REASON THIS DOESN'T LOAD DURING RUNTIME -,-
//    implementation 'org.json:json:20211205'
//    shadow 'org.json:json:20211205'
}

/*shadowJar {
    archiveBaseName.set('flashnpcs-shadow')
    archiveClassifier.set('')
    archiveVersion.set(project.version)

    minimize()

    dependencies {
//        include(dependency('org.json:json:20211205'))
    }
}*/

jar {
    manifest {
        attributes([
                "Specification-Title"     : "flashnpcs",
                "Specification-Vendor"    : "FlashHUN",
                "Specification-Version"   : "1",
                "Implementation-Title"    : project.name,
                "Implementation-Version"  : project.version,
                "Implementation-Vendor"   : "FlashHUN",
                "MixinConfigs"            : "flashnpcs.mixins.json",
                "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
        ])
    }
}

repositories {

}

//jar.dependsOn shadowJar
//jar.enabled = false    Why was this here again?

jar.finalizedBy('reobfJar')

任何帮助感激不尽。

3phpmpom

3phpmpom1#

这个依赖关系看起来很奇怪,通常依赖关系的形式是company:software:version,并且取决于我是看你的标题还是你的构建脚本,你有一个尾随的-42.0.1-42.0.1:userdev
尝试删除它,即使用

dependencies {
    minecraft 'net.minecraftforge:forge:1.19.2'
}

参见the maven repository

相关问题