neoforged / NeoGradle

Gradle plugin for NeoForge development
GNU Lesser General Public License v2.1
41 stars 24 forks source link

Client Fails to Start When Space is in Project Path #20

Closed NovaMachina closed 9 months ago

NovaMachina commented 9 months ago

If the project folder is in a location with spaces in the path, the run configurations generated by NeoGradle will not start.

I was able to confirm this issue by pulling the base MDK without modifying it and placing it in the following location: /home/user/Projects/Minecraft Mods/TestProject After the project was synced and the run configuration TestProject: Client was run, the following error would occur:

Error: Could not find or load main class Mods.TestProject.build.neoForm.neoFormJoined1.20.2-20231019.002635.steps.writeMinecraftClasspath.classpath.txt
Caused by: java.lang.ClassNotFoundException: Mods.TestProject.build.neoForm.neoFormJoined1.20.2-20231019.002635.steps.writeMinecraftClasspath.classpath.txt

The actual command executed on the command line (formatted so its easier to read):

/home/user/.jdks/jbr-17.0.9/bin/java -p
/home/user/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-commons/9.5/19ab5b5800a3910d30d3a3e64fdb00fd0cb42de0/asm-commons-9.5.jar:
/home/user/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-util/9.5/64b5a1fc8c1b15ed2efd6a063e976bc8d3dc5ffe/asm-util-9.5.jar:
/home/user/.gradle/caches/modules-2/files-2.1/net.neoforged/JarJarFileSystems/0.4.0/ef7e5716525bbe50c784a362f9393457a33e6daf/JarJarFileSystems-0.4.0.jar:
/home/user/.gradle/caches/modules-2/files-2.1/cpw.mods/securejarhandler/2.1.10/51e6a22c6c716beb11e244bf5b8be480f51dd6b5/securejarhandler-2.1.10.jar:
/home/user/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm/9.5/dc6ea1875f4d64fbc85e1691c95b96a3d8569c90/asm-9.5.jar:
/home/user/.gradle/caches/modules-2/files-2.1/cpw.mods/bootstraplauncher/1.1.2/c546e00443d8432cda6baa1c860346980742628/bootstraplauncher-1.1.2.jar:
/home/user/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-tree/9.5/fd33c8b6373abaa675be407082fdfda35021254a/asm-tree-9.5.jar:
/home/user/.gradle/caches/modules-2/files-2.1/org.ow2.asm/asm-analysis/9.5/490bacc77de7cbc0be1a30bb3471072d705be4a4/asm-analysis-9.5.jar
--add-modules ALL-MODULE-PATH
--add-opens java.base/java.util.jar=cpw.mods.securejarhandler
--add-opens java.base/java.lang.invoke=cpw.mods.securejarhandler
--add-exports java.base/sun.security.util=cpw.mods.securejarhandler
--add-exports jdk.naming.dns/com.sun.jndi.dns=java.naming
-Dforge.logging.console.level=debug
-Dneoforge.enableGameTest=true
-Dforge.logging.markers=REGISTRIES
-DlegacyClassPath.file=/home/user/Projects/Minecraft Mods/TestProject/build/neoForm/neoFormJoined1.20.2-20231019.002635/steps/writeMinecraftClasspath/classpath.txt
-DignoreList=securejarhandler,asm,asm-commons,asm-tree,asm-util,asm-analysis,bootstraplauncher,JarJarFileSystems,events-1.0.2.jar,core-1.0.2.jar,language-java,language-lowcode,language-minecraft,client-extra,neoforge-
-Dfml.gameLayerLibraries=events-1.0.2.jar
-DmergeModules=jna-5.10.0.jar,jna-platform-5.10.0.jar
-Dforge.enabledGameTestNamespaces=examplemod
-Djava.net.preferIPv6Addresses=system
-Dfml.pluginLayerLibraries=core-1.0.2.jar,language-java-1.0.2.jar,language-lowcode-1.0.2.jar,language-minecraft-1.0.2.jar
-javaagent:/opt/jetbrains/intellij-ultimate/lib/idea_rt.jar=42595:/opt/jetbrains/intellij-ultimate/bin
-Dfile.encoding=UTF-8 @/tmp/idea_arg_file752691849 cpw.mods.bootstraplauncher.BootstrapLauncher
--launchTarget forgeclientuserdev
--version 20.2.14-beta
--assetIndex asset-index
--assetsDir /home/user/Projects/Minecraft Mods/TestProject/build/neoForm/neoFormJoined1.20.2-20231019.002635/steps/downloadAssets
--gameDir .
--fml.neoForgeVersion 20.2.14-beta
--fml.fmlVersion 1.0.2
--fml.mcVersion 1.20.2
--fml.neoFormVersion 20231019.002635

I was able to work around the issue by modifying the run configuration and putting quotes around the following arguments:

-DlegacyClassPath.file="/home/user/Projects/Minecraft Mods/TestProject/build/neoForm/neoFormJoined1.20.2-20231019.002635/steps/writeMinecraftClasspath/classpath.txt"
--assetsDir "/home/user/Projects/Minecraft Mods/TestProject/build/neoForm/neoFormJoined1.20.2-20231019.002635/steps/downloadAssets"
Shadows-of-Fire commented 9 months ago

Confirmed for eclipse, not sure if this impacts IDEA as well

lukebemish commented 9 months ago

XFactHD ran into it as well: https://discord.com/channels/313125603924639766/801175194298744902/1168692397182566461, with what appears to be IDEA, though I'm not entirely certain

lukebemish commented 9 months ago

I have tested this myself and can confirm that it occurs in IntelliJ as well

NovaMachina commented 9 months ago

Confirmed for eclipse, not sure if this impacts IDEA as well

I'm running IntelliJ Ultimate 2023.2.4