MinecraftForge / ForgeGradle

Minecraft mod development framework used by Forge and FML for the gradle build system
GNU Lesser General Public License v2.1
508 stars 436 forks source link

Fix project name in Eclipse and VSCode run generators #861

Closed Maaxed closed 2 years ago

Maaxed commented 2 years ago

This fixes an issue with Eclipse and VSCode run generators where runs are generated with the wrong project name.

Changing the name of the eclipse project in the build.gradle file of a mod, ie adding the following line

eclipse.project.name = "Test" // This name must be different from the gradle project name for the error to appear

would previously result in an error in the generated run files.

With this PR, the run generators use the name of the eclipse project as declared in the build.gradle to fill the PROJECT_ATTR attribute of the eclipse run xml and the projectName property of the VSCode run json.

SizableShrimp commented 2 years ago

Can you provide the exact error?

Maaxed commented 2 years ago

In Eclipse I get image and I cannot run the client/server unless I change "Projet" from "Example" to "Test" in the configuration

And in VSCode, I get image when running the runClient configuration

Maaxed commented 2 years ago

To be more precise, I tested by unzipping the MDK in a folder called Example and just added the following line to the build.gradle

eclipse.project.name = "Test"

When running the genEclipseRuns task, in the *.launch xmls I get

<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="Example"/>

instead of

<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="Test"/>

and in the VSCode launch.json when running the genVSCodeRuns, I get

"projectName": "Example",

instead of

"projectName": "Test",