Hi. This problem is bugging me for a while on Eclipse (with Buildship). I use AutoValue as annotation processor and annotations in my project to auto generate some classes inside folder MyProject/.apt_generated/. I have configured the Java Compiler to show warnings for “Unqualified access to instance field” (Eclipse-> right click on Project-> properties -> Java Compiler -> Errors/Warnings) but I want the /.apt_generated folder to be excluded from that scan to avoid several hundreds warnings.
I have tried:
eclipse { classpath { file { whenMerged {
def aptSources = entries.find { it.path == ‘.apt_generated’ }
aptSources.entryAttributes.put(‘ignore_optional_problems’,‘true’)
} } } }
but I get an exception on entryAttributes as aptSources turns out to be null (“Cannot get property entryAttributes’ on null object”) and of course the extra attribute is not added to the classpath.
My Classpath file:
<?xml version="1.0" encoding="UTF-8"?><classpathentry kind="src" output="bin/main" path="src/main/java">
<attributes>
<attribute name="gradle_scope" value="main"/>
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="src" path=".apt_generated">
<attributes>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin/default"/>
(As a new forum member, I am prevented from uploading it as a file and thus the in-post presentation)