build.gradle / JACo MP3 播放器

问题描述 投票:0回答:1

我正在制作 Minecraft Forge MOD。它使用 JACo MP3 播放器,但当我将其安装到客户端时出现运行时错误。在游戏中触发库事件时会导致错误:

[Client thread/INFO]: [CHAT] An unknown error occurred while attempting to perform this command
[Client thread/INFO]: [net.minecraftforge.client.ClientCommandHandler:func_71556_a:91]: java.lang.NoClassDefFoundError: jaco/mp3/player/MP3Player

当我从 Eclipse 编译或运行它时,我没有收到错误。我怀疑该库在 build.gradle 文件中没有正确配置。

以下是

build.gradle

buildscript {
    repositories {
        jcenter()
        maven {
            name = "forge"
            url = "http://files.minecraftforge.net/maven"
        }
        mavenLocal()
        mavenCentral()
    }
    dependencies {
        classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
    }
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'java'
apply plugin: 'eclipse'

version = "x"
group = "x"
archivesBaseName = "x"

tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
}

compileJava {
    sourceCompatibility = 1.8
    targetCompatibility = 1.8
}

tasks.withType(JavaExec) {
    jvmArgs('-Dfile.encoding=UTF-8')
}

minecraft {
    version = "1.8.9-11.15.1.2318-1.8.9"
    runDir = "run"
    mappings = "stable_20"
    
    makeObfSourceJar = false
    // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
}

dependencies {
    compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.9'
    compile fileTree(dir: 'src/main/resources/libs', includes: ['*.jar'])
    
}
repositories {
    jcenter()
}

processResources
{
    inputs.property "version", project.version
    inputs.property "mcversion", project.minecraft.version

    from(sourceSets.main.resources.srcDirs) {
        include 'mcmod.info'
        
        expand 'version':project.version, 'mcversion':project.minecraft.version
    }
        
    from(sourceSets.main.resources.srcDirs) {
        exclude 'mcmod.info'
    }
}

(没有路径问题)在任何地方都找不到与我想要的内容相关的信息。

java gradle mp3 minecraft-forge
1个回答
0
投票

你应该遮蔽它。着色意味着将其依赖项包含到编译的 jar 中。有关更多信息,请参阅如何使用 Gradle 创建具有实现依赖项的可执行 fat JAR?

© www.soinside.com 2019 - 2024. All rights reserved.