简体   繁体   English

Eclipse中的Maven编译器警告和错误

[英]Maven compiler warnings and errors in Eclipse

I already asked the opposite question but now I'm growing fond of Maven and would like to set compiler warnings in my pom that are actually mapped to the eclipse project, enabling eclipse to mark "wrong" lines with warnings. 我已经问了相反的问题,但现在我越来越喜欢Maven,并且想在我的pom中设置编译器警告,这些警告实际上映射到eclipse项目,使eclipse能够用警告标记“错误”的行。

I think(?) Maven already sets the tick to overwrite the default warnings per project, but then just copies the default values into the non default settings. 我认为(?)Maven已设置勾选以覆盖每个项目的默认警告,但只是将默认值复制到非默认设置。 Then it shouldn't be a big hasle for a plugin to eg set "Member can be static" to warn? 那么它应该不是一个大插头,例如设置“会员可以静态”警告?

Which is the write plugin? 哪个是写插件? I can't the the compiler plugin to have any options for this. 我不能为编译器插件提供任何选项。

Not sure I fully understand your question. 不确定我完全理解你的问题。 For the warnings bit, you can override it using the showWarnings entity in the maven compiler plugin: 对于警告位,您可以使用maven编译器插件中的showWarnings实体覆盖它:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
            <source>1.7</source>
            <target>1.7</target>
            <encoding>${project.build.sourceEncoding}</encoding>
            <showDeprecation>true</showDeprecation>
            <showWarnings>true</showWarnings>
        </configuration>
    </plugin>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM