Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to process SERVER only jar when trying to build #1129

Open
Elikill58 opened this issue Jun 20, 2024 · 11 comments
Open

Failed to process SERVER only jar when trying to build #1129

Elikill58 opened this issue Jun 20, 2024 · 11 comments

Comments

@Elikill58
Copy link

I want to build my plugin Negativity.

My command used: ./gradlew build. It were working fine few weeks ago, idk why it changes. Example of working moment on my repo here.

Actually, here is my gradle.properties :

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.20
yarn_mappings=1.20+build.1
loader_version=0.15.11

# Fabric API
fabric_version=0.83.0+1.20

Here is my builde.gradle:

import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

plugins {
    id 'fabric-loom' version '1.5.8'
    id 'io.github.goooler.shadow'
}

evaluationDependsOn(':common')

sourceSets {
    main {
        java.srcDirs = ['src']
        resources.srcDirs = ['resources']
    }
}

repositories {
    maven {
    	name 'minecraft'
    	url 'https://libraries.minecraft.net/'
    }
    maven {
    	name 'fabric'
    	url 'https://maven.fabricmc.net/'
    }
}

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

archivesBaseName = 'Negativity'

dependencies {
    api project(':common')
    
    minecraft "com.mojang:minecraft:${project.minecraft_version}"
    mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
    modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

    modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
}

compileJava.javaCompiler.set(
    javaToolchains.compilerFor { languageVersion = JavaLanguageVersion.of(17) }
)

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

    filesMatching("fabric.mod.json") {
        expand "version": project.version
    }
}

java {
    withSourcesJar()
}

loom {
    serverOnlyMinecraftJar()
}

tasks.withType(JavaCompile).configureEach {
    it.options.release = 17
}

shadowJar {
    dependencies {
        it.include(it.project(':common'))
    }

    from(project(':common').tasks.shadowJar)
}

build.dependsOn shadowJar

parent.tasks.named('shadowJar', ShadowJar) {
    it.from(shadowJar.outputs)
}

Here are my logs:

> Configure project :fabric
Fabric Loom: 1.5.8
Found existing cache lock file, rebuilding loom cache. This may have been caused by a failed or canceled build.

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':fabric'.
> Failed to setup Minecraft, java.lang.RuntimeException: Failed to process SERVER only jar

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

Without the line serverOnlyMinecraftJar(), I got this error: Failed to setup Minecraft, java.lang.RuntimeException: Failed to remap minecraft.

How to fix it?

@modmuss50
Copy link
Member

Hi, can you run with --stacktrace please? It may also be worth trying the latest version of loom (1.7.1)

@Elikill58
Copy link
Author

Elikill58 commented Jun 20, 2024

Hi, thanks for fast answer :)

I can't use 1.7-SNAPSHOT because of java version, I stay max on 1.6-SNAPSHOT.

Here are my stacktrace:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':fabric'.
> Failed to setup Minecraft, java.lang.RuntimeException: Failed to process SERVER only jar

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':fabric'.
	at org.gradle.configuration.project.LifecycleProjectEvaluator.wrapException(LifecycleProjectEvaluator.java:84)
	at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:77)
	at org.gradle.configuration.project.LifecycleProjectEvaluator.access$500(LifecycleProjectEvaluator.java:55)
	at org.gradle.configuration.project.LifecycleProjectEvaluator$NotifyAfterEvaluate.run(LifecycleProjectEvaluator.java:255)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
	at org.gradle.configuration.project.LifecycleProjectEvaluator$EvaluateProject.lambda$run$0(LifecycleProjectEvaluator.java:114)
	at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.lambda$applyToMutableState$1(DefaultProjectStateRegistry.java:407)
	at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.lambda$fromMutableState$2(DefaultProjectStateRegistry.java:430)
	at org.gradle.internal.work.DefaultWorkerLeaseService.withReplacedLocks(DefaultWorkerLeaseService.java:360)
	at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.fromMutableState(DefaultProjectStateRegistry.java:430)
	at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.applyToMutableState(DefaultProjectStateRegistry.java:406)
	at org.gradle.configuration.project.LifecycleProjectEvaluator$EvaluateProject.run(LifecycleProjectEvaluator.java:100)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
  [Omitted output]
	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
	at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:84)
	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
	at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:52)
	at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:47)
Caused by: java.lang.RuntimeException: Failed to setup Minecraft, java.lang.RuntimeException: Failed to process SERVER only jar
	at net.fabricmc.loom.util.ExceptionUtil.createDescriptiveWrapper(ExceptionUtil.java:59)
	at net.fabricmc.loom.configuration.CompileConfiguration.lambda$run$1(CompileConfiguration.java:119)
	at net.fabricmc.loom.configuration.CompileConfiguration.lambda$afterEvaluationWithService$6(CompileConfiguration.java:432)
	at net.fabricmc.loom.util.gradle.GradleUtils.lambda$afterSuccessfulEvaluation$0(GradleUtils.java:45)
	at org.gradle.internal.code.DefaultUserCodeApplicationContext$CurrentApplication$1.execute(DefaultUserCodeApplicationContext.java:122)
	at org.gradle.configuration.internal.DefaultListenerBuildOperationDecorator$BuildOperationEmittingAction$1.run(DefaultListenerBuildOperationDecorator.java:173)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:68)
	at org.gradle.configuration.internal.DefaultListenerBuildOperationDecorator$BuildOperationEmittingAction.execute(DefaultListenerBuildOperationDecorator.java:170)
	at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:99)
	at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:87)
	at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:43)
	at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:268)
	at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:170)
	at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:83)
	at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:69)
	at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:381)
	at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:272)
	at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:148)
	at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:37)
  [Omitted output]
	at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:39)
	at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:47)
	at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:31)
	at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:65)
	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
	at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:39)
	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
	at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:29)
	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
	at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:35)
	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
	at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:78)
	at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.create(ForwardClientInput.java:75)
	at org.gradle.util.internal.Swapper.swap(Swapper.java:38)
	at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:75)
	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
	at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:64)
	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
	at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:63)
	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
	at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:84)
	at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:37)
	at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
	at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:52)
	at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:297)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:47)
Caused by: java.lang.RuntimeException: Failed to process SERVER only jar
	at net.fabricmc.loom.configuration.providers.minecraft.SingleJarMinecraftProvider.provide(SingleJarMinecraftProvider.java:109)
	at net.fabricmc.loom.configuration.CompileConfiguration.setupMinecraft(CompileConfiguration.java:169)
	at net.fabricmc.loom.configuration.CompileConfiguration.lambda$run$1(CompileConfiguration.java:111)
	... 181 more
Caused by: java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: 'int org.objectweb.asm.Type.getArgumentCount(java.lang.String)'
	at net.fabricmc.tinyremapper.TinyRemapper.waitForAll(TinyRemapper.java:1201)
	at net.fabricmc.tinyremapper.TinyRemapper.apply(TinyRemapper.java:943)
	at net.fabricmc.tinyremapper.TinyRemapper.apply(TinyRemapper.java:903)
	at net.fabricmc.loom.configuration.providers.minecraft.SingleJarMinecraftProvider.provide(SingleJarMinecraftProvider.java:105)
	... 183 more
Caused by: java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: 'int org.objectweb.asm.Type.getArgumentCount(java.lang.String)'
	at net.fabricmc.tinyremapper.TinyRemapper.waitForAll(TinyRemapper.java:1198)
	... 186 more
Caused by: java.lang.NoSuchMethodError: 'int org.objectweb.asm.Type.getArgumentCount(java.lang.String)'
	at org.objectweb.asm.tree.MethodNode.visitParameterAnnotation(MethodNode.java:297)
	at org.objectweb.asm.MethodVisitor.visitParameterAnnotation(MethodVisitor.java:213)
	at org.objectweb.asm.commons.MethodRemapper.visitParameterAnnotation(MethodRemapper.java:104)
	at org.objectweb.asm.ClassReader.readParameterAnnotations(ClassReader.java:2957)
	at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1489)
	at org.objectweb.asm.ClassReader.accept(ClassReader.java:744)
	at org.objectweb.asm.ClassReader.accept(ClassReader.java:424)
	at net.fabricmc.tinyremapper.TinyRemapper.apply(TinyRemapper.java:1108)
	at net.fabricmc.tinyremapper.TinyRemapper.lambda$apply$5(TinyRemapper.java:939)

@modmuss50
Copy link
Member

java.lang.NoSuchMethodError: 'int org.objectweb.asm.Type.getArgumentCount(java.lang.String)'

This is likely caused by one of your other gradle plugins, or an incorrect setup of the plugins in a multi project build. Please make sure to define all of your plugin versions in the root project as detailed in the gradle docs here: https://docs.gradle.org/current/userguide/plugins.html#sec:subprojects_plugins_dsl

I can't use 1.7-SNAPSHOT because of java version, I stay max on 1.6-SNAPSHOT.

1.7 has the same Java version requirements of 1.6.

@Elikill58
Copy link
Author

Oh yes, I can use 1.7 and the java issue were because of gradle version not supported. After upgrading from 8.6 to 8.8, I can use version 1.7.

I'm not using this for subprojects. I changed the gradle config by using this in the main project:

plugins {
    id 'java-library'
    id 'io.github.goooler.shadow' version '8.1.7'
    id 'fabric-loom' version '1.7-SNAPSHOT' apply false
}

But I got the same issue

@modmuss50
Copy link
Member

Humm, odd, can you run with --info and look for a log line starting with (org.objectweb.asm.ClassVisitor) with version (9.6) was loaded from

It will then give you a path saying where the asm classes have been loaded from, it should be asm-9.6.jar

@Elikill58
Copy link
Author

It's using version 9.2 and not 9.6:

(kotlinx.metadata.jvm.KotlinClassMetadata) with version (0.9.0-1.9.21-40) was loaded from (/C:/Users/Elikill58/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlinx/kotlinx-metadata-jvm/0.9.0/123e86fd82d3a49afd0a41df1288a40c969f11b2/kotlinx-metadata-jvm-0.9.0.jar)
(org.objectweb.asm.ClassVisitor) with version (9.2) was loaded from (/C:/Users/Elikill58/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm/9.2/81a03f76019c67362299c40e0ba13405f5467bff/asm-9.2.jar)
(org.objectweb.asm.tree.analysis.Analyzer) with version (9.7) was loaded from (/C:/Users/Elikill58/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/9.7/e4a258b7eb96107106c0599f0061cfc1832fe07a/asm-analysis-9.7.jar)
(org.objectweb.asm.commons.ClassRemapper) with version (9.7) was loaded from (/C:/Users/Elikill58/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-commons/9.7/e86dda4696d3c185fcc95d8d311904e7ce38a53f/asm-commons-9.7.jar)
(org.objectweb.asm.tree.ClassNode) with version (9.7) was loaded from (/C:/Users/Elikill58/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-tree/9.7/e446a17b175bfb733b87c5c2560ccb4e57d69f1a/asm-tree-9.7.jar)
(org.objectweb.asm.util.ASMifier) with version (9.7) was loaded from (/C:/Users/Elikill58/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-util/9.7/c0655519f24d92af2202cb681cd7c1569df6ead6/asm-util-9.7.jar)
(com.google.gson.Gson) with version (null) was loaded from (/C:/Users/Elikill58/.gradle/caches/modules-2/files-2.1/com.google.code.gson/gson/2.10.1/b3add478d4382b78ea20b1671390a858002feb6c/gson-2.10.1.jar)
(com.google.common.base.Preconditions) with version (null) was loaded from (/C:/Users/Elikill58/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/33.0.0-jre/161ba27964a62f241533807a46b8711b13c1d94b/guava-33.0.0-jre.jar)
(org.apache.commons.io.FileUtils) with version (2.15.1) was loaded from (/C:/Users/Elikill58/.gradle/caches/modules-2/files-2.1/commons-io/commons-io/2.15.1/f11560da189ab563a5c8e351941415430e9304ea/commons-io-2.15.1.jar)

@modmuss50
Copy link
Member

Thats annoying, this is Gradle at its finest, its likely caused by one of your other plugins, make sure they are all up to date. Do make sure that ALL the plugin versions are defined in the root project, not just loom.

@Elikill58
Copy link
Author

I just upgraded all possible plugins I'm using, I also checked for each build gradle file and it should be fine.

You can find my commit here: Elikill58/Negativity@fcdaa2f

@Technici4n
Copy link
Member

I suppose that shading most dependencies would fix this issue?

@Elikill58
Copy link
Author

I suppose that shading most dependencies would fix this issue?

They are already shadowed

@Elikill58
Copy link
Author

I tried 1.8.11 with gradle 8.10 and I got the same result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants