I'm developing a multi-module minecraft server-side mod project, and I have a core module to be included in other modules. But when it comes to the neoforge module, although the finally built jar file includes the code of core module, the task runServer cannot find the classes in core module and throws ClassNotFoundException.
build.gradle of my neoforge module:
plugins {
id 'eclipse'
id 'idea'
id 'com.gradleup.shadow' version '8.3.8'
id 'net.neoforged.gradle.userdev' version '7.0.192'
}
configurations {
shadowImplementation
implementation.extendsFrom(shadowImplementation)
runtimeClasspath.extendsFrom(localRuntime)
}
// ...
runs {
server {
workingDirectory project.file('run')
argument '--nogui'
}
}
// ...
dependencies {
implementation "net.neoforged:neoforge:${neo_version}"
shadowImplementation(project(":core")) {
// To avoid conflict
exclude group: 'com.github.oshi', module: 'oshi-core'
exclude group: 'org.slf4j', module: 'slf4j-api'
}
implementation "com.github.oshi:oshi-core:6.8.2"
}
// ...
shadowJar {
// ...
}
build {
dependsOn shadowJar
}
// ...
I'm developing a multi-module minecraft server-side mod project, and I have a core module to be included in other modules. But when it comes to the neoforge module, although the finally built jar file includes the code of core module, the task
runServercannot find the classes in core module and throws ClassNotFoundException.build.gradleof my neoforge module: