Gradle plugin to create fat/uber JARs, apply file transforms, and relocate packages for applications and libraries. Gradle version of Maven's Shade plugin.
Fabric Loom can't be applied to my project after I added the shadow plugin.
Error log:
An exception occurred applying plugin request [id: 'fabric-loom', version: '1.5-SNAPSHOT']
> Failed to apply plugin 'fabric-loom'.
> Could not create task ':mod:remapJar'.
> Could not create task of type 'RemapJarTask'.
> class net.fabricmc.loom.util.service.BuildSharedServiceManager$Inject cannot be cast to class net.fabricmc.loom.util.service.BuildSharedServiceManager (net.fabricmc.loom.util.service.BuildSharedServiceManager$Inject is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader$InstrumentingVisitableURLClassLoader @295c26f5; net.fabricmc.loom.util.service.BuildSharedServiceManager is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader$InstrumentingVisitableURLClassLoader @3866e74a)
I'm not sure if it is a Shadow issue, but I'm sure the build fails after I added the plugin.
The Shadow plugin not configured yet, as you can see in the provided build script.
Gradle Build Script(s)
plugins {
id 'fabric-loom' version '1.5-SNAPSHOT'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'java'
}
version = parent.version
group = parent.group
repositories {
maven {
name "minecraft"
url "https://libraries.minecraft.net/"
}
}
dependencies {
minecraft "com.mojang:minecraft:${parent.minecraft_version}"
mappings "net.fabricmc:yarn:${parent.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${parent.loader_version}"
}
processResources {
filteringCharset "UTF-8"
}
def targetJavaVersion = 17
tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
it.options.release.set(targetJavaVersion)
}
}
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
withSourcesJar()
}
Content of Shadow JAR (jar tf <jar file> - post link to GIST if too long)
Please check the User Guide before submitting "how do I do 'x'?" questions!
I've checked that and it can't solve my issue. Same issue as https://github.com/FabricMC/fabric-loom/issues/1036
Shadow Version
8.1.1
Gradle Version
8.5
Expected Behavior
My subproject compiles correctly
Actual Behavior
Fabric Loom can't be applied to my project after I added the shadow plugin.
Error log:
I'm not sure if it is a Shadow issue, but I'm sure the build fails after I added the plugin. The Shadow plugin not configured yet, as you can see in the provided build script.
Gradle Build Script(s)
Content of Shadow JAR (
jar tf <jar file>
- post link to GIST if too long)Nothing because build simply fails.