From c6ed90e28c554395eb0f65e09d97b258792647f8 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 7 Sep 2026 14:56:30 +0100 Subject: [PATCH] Set ignore_optional_problems on all proto-generated source Closes gh-51604 --- .../springframework/boot/build/EclipseConventions.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/buildSrc/src/main/java/org/springframework/boot/build/EclipseConventions.java b/buildSrc/src/main/java/org/springframework/boot/build/EclipseConventions.java index fd1c33f219b..c7ccf869137 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/EclipseConventions.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/EclipseConventions.java @@ -29,6 +29,7 @@ import org.gradle.plugins.ide.eclipse.model.EclipseClasspath; import org.gradle.plugins.ide.eclipse.model.EclipseJdt; import org.gradle.plugins.ide.eclipse.model.EclipseModel; import org.gradle.plugins.ide.eclipse.model.Library; +import org.gradle.plugins.ide.eclipse.model.SourceFolder; /** * Conventions that are applied in the presence of the {@link EclipsePlugin} to work @@ -95,6 +96,7 @@ class EclipseConventions { merger.whenMerged((content) -> { if (content instanceof Classpath classpath) { classpath.getEntries().removeIf(this::isKotlinPluginContributedBuildDirectory); + classpath.getEntries().forEach(this::ignoreOptionalProblemsInProtoGeneratedSources); } }); } @@ -121,4 +123,10 @@ class EclipseConventions { return (value instanceof String string && Boolean.parseBoolean(string)); } + private void ignoreOptionalProblemsInProtoGeneratedSources(ClasspathEntry entry) { + if (entry instanceof SourceFolder source && source.getPath().startsWith("build/generated/sources/proto/")) { + source.getEntryAttributes().put("ignore_optional_problems", true); + } + } + }