Gradle - How to isolate concurrent runs?

I’ve run into some problems this week with my game, I noticed the game would work when it was played on another computer and someone else joined, but me running two games (server+client and a second client) on my computer caused JVM crashes, and class not found errors.

After some debugging and very long stares at hs_err_pidXXX logs (y’all know the struggle) I found out the errors were caused by classes in the gradle build folder being changed + deleted when I build the game a second time… Closing one game deleted the files for the server, and when it went to load the classes for the disconnect event the server crashed.

I sifted the internet for gradle task properties of the “application” plugin’s “run” task, to maybe run the program in a second build folder, but no luck…

I’m considering changing my run task to build the game into a jar, and run that instead… But I havent written gradle scripts before and that seems like a pain.

If anyone has some ideas on how to isolate gradle runs that would be awesome!