@@ -1082,6 +1082,16 @@ eclipse {
10821082 classpath {
10831083 downloadSources = true
10841084 downloadJavadoc = true
1085+ file. whenMerged { classpath ->
1086+ classpath. entries. removeAll { entry ->
1087+ entry instanceof org.gradle.plugins.ide.eclipse.model.SourceFolder
1088+ && [' src/main/resources' , ' src/generated/resources' ]. contains(entry. path)
1089+ }
1090+ if (! classpath. entries. any { entry -> entry. path == ' build/resources/main' }) {
1091+ classpath. entries. add(new org.gradle.plugins.ide.eclipse.model.SourceFolder (
1092+ ' build/resources/main' , ' bin/main' ))
1093+ }
1094+ }
10851095 }
10861096 synchronizationTasks ' isolateEclipseProductionRuns'
10871097}
@@ -1163,11 +1173,15 @@ tasks.register('verifyEclipseProductionClasspath') {
11631173 " Forge 1.17 Eclipse classpath contains legacy LWJGL 2 artifacts: ${ legacyLwjglArtifacts} " )
11641174 }
11651175 File eclipseClasspath = file(' .classpath' )
1166- if (! eclipseClasspath. isFile()
1167- || ! eclipseClasspath. getText(' UTF-8' ). contains(
1168- ' path="src/generated/resources"' )) {
1176+ if (! eclipseClasspath. isFile()) {
1177+ throw new GradleException (' Eclipse .classpath was not generated' )
1178+ }
1179+ String eclipseClasspathText = eclipseClasspath. getText(' UTF-8' )
1180+ if (! eclipseClasspathText. contains(' path="build/resources/main"' )
1181+ || eclipseClasspathText. contains(' path="src/main/resources"' )
1182+ || eclipseClasspathText. contains(' path="src/generated/resources"' )) {
11691183 throw new GradleException (
1170- ' Eclipse does not expose the generated production-resource source folder ' )
1184+ ' Eclipse must consume only Gradle-processed production resources ' )
11711185 }
11721186 [
11731187 ' META-INF/mods.toml' ,
@@ -1178,6 +1192,16 @@ tasks.register('verifyEclipseProductionClasspath') {
11781192 throw new GradleException (" Eclipse output is missing ${ relative} " )
11791193 }
11801194 }
1195+ File processedModMetadata = new File (sourceSets. main. output. resourcesDir,
1196+ ' META-INF/mods.toml' )
1197+ File eclipseModMetadata = file(' bin/main/META-INF/mods.toml' )
1198+ if (! java.util.Arrays . equals(processedModMetadata. bytes, eclipseModMetadata. bytes)
1199+ || eclipseModMetadata. getText(' UTF-8' ). contains(' ${version}' )
1200+ || ! eclipseModMetadata. getText(' UTF-8' ). contains(
1201+ " version=\" ${ project.version} \" " )) {
1202+ throw new GradleException (
1203+ ' Eclipse output contains unexpanded or stale Forge mod metadata' )
1204+ }
11811205 List<String > forbidden = [
11821206 ' src/test' , ' bin/test' , ' build/classes/java/test' ,
11831207 ' biomeIntegrationTest' , ' clientIntegrationTest' ,
0 commit comments