Search code examples
eclipsemavenm2eclipse

Configure m2e to ignore warnings in generated-sources folder


I have a project which generates some code using Axis. This code is full of warnings (most of them, lack of generics), so, I usually just configure that source folder to ignore warnings.

Is there a way to do that using m2e or another maven plugin?

The advantage of that would show up when more people start using the project.


Solution

  • I do not use AXIS but I had a similar problem when using JAXB for code generation. My solution was to annotate each class with @SuppressWarnings.

    For JAXB I used the annox plugin. You can create a binding file that contains the following:

    <jaxb:bindings schemaLocation="YourSchema.xsd"
        xmlns:annox="http://annox.dev.java.net" jaxb:extensionBindingPrefixes="annox">
        <jaxb:bindings multiple="true" node="/xs:schema/xs:complexType">
            <annox:annotate>
                <annox:annotateClass annox:class="java.lang.SuppressWarnings">
                    <annox:annotate annox:field="value">all</annox:annotate>
                </annox:annotateClass>
            </annox:annotate>
        </jaxb:bindings>
    

    so you do not have to touch your schema.