配置m2e以忽略generated-sources文件夹中的警告

时间:2014-09-17 17:46:37

标签: eclipse maven m2eclipse

我有一个使用Axis生成一些代码的项目。这段代码充满了警告(大多数都没有泛型),因此,我通常只是配置该源文件夹来忽略警告。

有没有办法用m2e或其他maven插件做到这一点?

当更多人开始使用该项目时,会出现这种优势。

1 个答案:

答案 0 :(得分:1)

我不使用AXIS,但在使用JAXB进行代码生成时遇到了类似的问题。我的解决方案是使用@SuppressWarnings注释每个类。

对于JAXB,我使用了annox插件。您可以创建包含以下内容的绑定文件:

<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>

所以你不必触摸你的架构。

相关问题