问题
We use Eclipse for our Java development, and we've got Maven compiling our JSPs into servlets to be used in our embedded Jetty instance. This means that to run the project from Eclipse, I have to include ./target/jsp-source as a source folder, which works great. The warnings that show up for that generated code are everywhere though, and I want to filter them out.
mainMenu_jsp.java has a warning about a local variable not being used. It's generated code, so I don't care about it, but I can't figure out how to filter out any warnings by filename pattern.
I know I can define a working set, but because I'm always opening,closing, and sometimes adding and deleting projects, I don't want another point of manual bookkeeping that I have to keep up to date. If I add a new project and forget to go in and add it to the working set, I won't get any warnings for it, which with all the other projects, I might not notice. Working sets would only really work if there was a way to set them to dynamically expand to include all projects (not just all right now), and have their filtering automatically apply to each new project as it's added.
回答1:
Just use a Working Set. Details about how to do it here: Excluding Unfixables from Eclipse Problem View
And here: Eclipse Problems view
回答2:
[Using a Working Set] doesn't work for a lot of situations.
For example, the Android Eclipse plug-in generates code into the same project.
A working set consists of one or more projects, in their entirety, so a working set can't filter out generated warnings that are intra-project.
Edit:
I learned something super-useful: working sets can filter out parts of projects. It's simple to do--click on the project in the left pane of the working-set editor and expand it. Then only add what you want.
回答3:
A working set works well with multiple projects. I suggest you try using one.
来源:https://stackoverflow.com/questions/230199/filtering-warnings-in-eclipse-by-filename