You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Suggestion: Ignore compiler warnings and information from specified directories #660
As a user of the vscode-java extension, I would like to ignore Java compiler warnings and information coming from certain directories.
Generated code and unit tests often generate warnings from the compiler. I would like to have warnings coming from certain directories suppressed so it'll be easier to find warnings from code we're interested in.
files.ignore is not good enough because sometimes you want to ignore warnings coming from unit tests. For example, you might want to test your equals() method against different objects, but you will get an information message telling you that it's an unlikely argument.
For now, entering src/main/** into the problems filter seems to be good enough for now, but I would like to create a workspace with some sane defaults for my coworkers to use when pulling the project.
Since VS Code no longer generates the .classpath files inside the workspace, it is quite difficult to modify them directly, especially when using a remote devcontainer. Having a UI to add this boolean attribute, or a menu item to open the .classpath file for the project would be absolutely helpful. At this time I can't recommend using VS Code for our project as the number of warnings in generated dwarfs the actual warnings in our code base, and we have a zero warning policy.
Should be great to have an option to do this in the JAVA PROJECTS view by a right click in an specific source folder (or in the Configure Classpath page).
Any chance for the ignore_optional_problems to be added for any folder under "target/generated-sources" (like it is currently automatically being added for target/generated-sources/annotations and target/generated-test-sources/test-annotations)?
Any chance for the ignore_optional_problems to be added for any folder under "target/generated-sources" (like it is currently automatically being added for target/generated-sources/annotations and target/generated-test-sources/test-annotations)?
This would be great. I use a Maven plugin to generate a lot of sources in target/generated-sources/** and I have thousands of warnings 🤯
I need to test this in full, but it appears that the java.diagnostic.filter option allows you to exclude directories completely from warnings, without causing project recognition issues (like I had earlier with a java resource filter on the target directory).
Activity
fbricon commentedon Oct 3, 2018
You can add an
ignore_optional_problemsflag to your project's .classpath file, like:BlazerYang commentedon Jul 17, 2019
same problem, any solution yet?
dashorst commentedon Jun 27, 2022
Since VS Code no longer generates the .classpath files inside the workspace, it is quite difficult to modify them directly, especially when using a remote devcontainer. Having a UI to add this boolean attribute, or a menu item to open the .classpath file for the project would be absolutely helpful. At this time I can't recommend using VS Code for our project as the number of warnings in generated dwarfs the actual warnings in our code base, and we have a zero warning policy.
rubensa commentedon Sep 14, 2022
Should be great to have an option to do this in the JAVA PROJECTS view by a right click in an specific source folder (or in the Configure Classpath page).
(related to: #2150)
rubensa commentedon May 29, 2023
Any chance for the
ignore_optional_problemsto be added for any folder under "target/generated-sources" (like it is currently automatically being added fortarget/generated-sources/annotationsandtarget/generated-test-sources/test-annotations)?heruan commentedon Feb 12, 2024
This would be great. I use a Maven plugin to generate a lot of sources in
target/generated-sources/**and I have thousands of warnings 🤯snjeza commentedon Feb 12, 2024
@rubensa @heruan You can try the ecliseignorehelper plugin.
mrgarbagegamer commentedon Jan 27, 2026
I think I've found it!
I need to test this in full, but it appears that the
java.diagnostic.filteroption allows you to exclude directories completely from warnings, without causing project recognition issues (like I had earlier with a java resource filter on the target directory).