如何在 Maven 项目中使用 -Xlint:unchecked 进行编译? [英] How to compile using -Xlint:unchecked in a Maven project?

查看:31
本文介绍了如何在 Maven 项目中使用 -Xlint:unchecked 进行编译?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 NetBeans 7.2 中,我无法找到如何在 Maven 项目中使用 -Xlint:unchecked 进行编译.在 Ant 项目下,您可以通过转到项目属性 -> 编译来更改编译器标志,但 Maven 项目似乎没有任何此类选项.

In NetBeans 7.2, I'm having trouble finding how to compile using -Xlint:unchecked in a Maven project. Under an Ant project, you can change compiler flags by going to Project Properties -> Compiling, but Maven projects don't seem to have any such option.

有什么方法可以配置 IDE 以使用 Maven 使用此类标志进行编译?

Is there any way to configure the IDE to compile with such flags using Maven?

推荐答案

我猜你可以在你的 pom.xml 中设置编译器参数.请参考这个 http://maven.apache.org/plugins/maven-compiler-plugin/examples/pass-compiler-arguments.html

I guess you can set compiler arguments in your pom.xml. Please refer this http://maven.apache.org/plugins/maven-compiler-plugin/examples/pass-compiler-arguments.html

 <compilerArgument>-Xlint:unchecked</compilerArgument>

这篇关于如何在 Maven 项目中使用 -Xlint:unchecked 进行编译?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆