How can I disable compiler warnings in Eclipse on a file specific basis?

kutuzof picture kutuzof · Sep 2, 2010 · Viewed 52.5k times · Source

In my Eclipse project are a handful of generated .java files that I need to use for SQLJ and I can't move to a separate project (due to Administrative Overhead). These files are also regularly regenerated so editing them is unfortunately out.

Unfortunately these files generate a few hundred java compiler warnings which drown out the useful warnings I get on files that I actually can edit.

Is there any way in Eclipse to say Ignore all the warnings of a file-by-file basis? Or can I block out a specific sub-directory?

Answer

Edward Brey picture Edward Brey · Oct 10, 2013

Ensure the files are under the gen folder, the typical home for all generated .java files. Then in the project properties, under Java Build Path, set Ignore optional compile problems for that folder to Yes.

If your project structure requires your files be in a folder other than gen, add that folder to the Java Build Path so that you can enable ignoring optional compile problems for it.