Search code examples
javaeclipseapache-axism2eclipse

Can one specify Java warning settings per project in Eclipse?


I have a Java project which is a combination of human-written Java code and Java code generated by axis2.

The axis2 generated code provokes thousands of warnings from the Java compiler (either javac or the one built into Eclipse). Examples of warnings: dead code, use of raw list and array types predating Java generics, etc. (more at http://www.coderanch.com/t/501752/Web-Services/java/Axis-Generate-without-Warnings). I'd like to silence and ignore these specific warnings in the generated code, but not the human-written code.

I've seen How to add -Xlint:unchecked option or any javac option in Eclipse? and that allows me to disable the relevant warnings via Window->Preferences, but workspace-wide, which is not what I want. Is there a way to do this on a per-project basis?

If not, how do people deal with generated code without ignoring warnings that would be useful to humans?


Solution

  • You can enable lots of different options on a per-project basis. Assuming you're using Helios, here's how to configure warnings on a particular project:

    1. Right-click the project (or select the project, then Alt+Enter)
    2. Java Compiler → Errors/Warnings
    3. Check "Enable project specific settings" (does the missing hyphen bug you? It bugs me)
    4. Configure away!

    illustrious illustration!