ARTICLE AD BOX
I'm building a Java Spring Boot 4 backend platform split into microservices and leverage GRPC as communication protocol for in-between the microservices. My build tool is Gradle and I am facing an issue (probably) exclusive to EclipseIDE.
Following dev conventions, I created my .proto file under src/main/proto/billing_service.proto. In build.gradle I declared the GRPC dependencies correctly. With ./gradlew compileJava Gradle compiles them and generates the necessary GRPC .java files effortlessly under build/generated/sources/proto/main/java and build/generated/sources/proto/main/grpc. (I can confirm their existence in my Mac's finder)
Because EclipseIDE only allows importing files from outside the project's src/ when they are sitting in source-folders, I am marking the generated grpc repositories as source-folders using the Gradle Eclipse plugin:
eclipse { classpath { file.whenMerged { cp -> cp.entries.add(new org.gradle.plugins.ide.eclipse.model.SourceFolder( 'build/generated/source/proto/main/java', null)) cp.entries.add(new org.gradle.plugins.ide.eclipse.model.SourceFolder( 'build/generated/source/proto/main/grpc', null)) } } }Except for build/generated/sources/proto/main/grpc EclipseIDE recognizes all of them and allows me imports. However, build/generated/sources/proto/main/grpc isn't being shown no matter whether I ./gradlew cleanEclipse eclipse, delete and re-import my Gradle project into EclipseIDE, or simply refresh it. I can confirm that build/generated/sources/proto/main/grpc is populated with the necessary .java file - so it is not empty.
Is there an EclipseIDE internal hack or Gradle snippet that will make all of these folders being shown and referenceable correctly?

----------------------------------
EDIT I love programming: spent 2h fighting with it, 20 minutes writing this question, thereafter retried another possible solution and resolved it.
The fix was to declare the classpath as source-folder before the buildship plugin can overwrite the changes by using file.beforeMerged {} instead of file.whenMerged {}. The following change resolved the issue:
eclipse { classpath { file.beforeMerged { cp -> cp.entries.add( new org.gradle.plugins.ide.eclipse.model.SourceFolder( 'build/generated/source/proto/main/grpc', null)) cp.entries.add( new org.gradle.plugins.ide.eclipse.model.SourceFolder( 'build/generated/source/proto/main/java', null)) } } }
