diff --git a/src/main/java/net/fabricmc/loom/decompilers/fernflower/ForkingJavaExec.java b/src/main/java/net/fabricmc/loom/decompilers/fernflower/ForkingJavaExec.java index 8b5f5f6..4c0e21a 100644 --- a/src/main/java/net/fabricmc/loom/decompilers/fernflower/ForkingJavaExec.java +++ b/src/main/java/net/fabricmc/loom/decompilers/fernflower/ForkingJavaExec.java @@ -24,11 +24,12 @@ package net.fabricmc.loom.decompilers.fernflower; +import java.util.HashSet; +import java.util.Set; + import org.gradle.api.Action; import org.gradle.api.Project; -import org.gradle.api.artifacts.ConfigurationContainer; -import org.gradle.api.artifacts.dsl.DependencyHandler; -import org.gradle.api.file.FileCollection; +import org.gradle.api.artifacts.Configuration; import org.gradle.process.ExecResult; import org.gradle.process.JavaExecSpec; @@ -40,14 +41,21 @@ import org.gradle.process.JavaExecSpec; */ public class ForkingJavaExec { public static ExecResult javaexec(Project project, Action action) { - ConfigurationContainer configurations = project.getBuildscript().getConfigurations(); - DependencyHandler handler = project.getDependencies(); - FileCollection classpath = configurations.getByName("classpath")// - .plus(configurations.detachedConfiguration(handler.localGroovy())); - return project.javaexec(spec -> { - spec.classpath(classpath); + spec.classpath(getForkedFernflowerClasspath(project)); action.execute(spec); }); } + + private static Set getForkedFernflowerClasspath(Project project) { + Set allConfigurations = new HashSet<>(); + Project p = project; + + do { + allConfigurations.addAll(p.getBuildscript().getConfigurations()); + p = p.getRootProject(); + } while (p != p.getRootProject()); + + return allConfigurations; + } }