我使用ant在iterm2中构建和部署java web项目,现在我遇到了问题。当我编译项目时,有很多全屏警告,我无法读取蚂蚁报告的错误。这是我的ant javac任务def:
<echo message="begin compile..." />
<javac srcdir="${src.dir}" destdir="${build.dir}"
includeantruntime="false" nowarn="on"
source="1.7" target="1.7" deprecation="true" debug="true"
encoding="UTF-8" classpathref="project.classpath">
<compilerarg line="-Xlint:unchecked" />
</javac>
<copy todir="${build.dir}">
<fileset dir="${src.dir}">
<include name="**/*.xml" />
<include name="**/*.properties" />
<include name="**/*.sql" />
</fileset>
</copy>
<echo message="end compile..." />
如何告诉ant不显示警告并仅显示错误?
答案 0 :(得分:1)
要禁用多种警告,请替换...
<compilerarg line="-Xlint:unchecked" />
...与...
<compilerarg value="-Xlint:none" />
有关未经检查的转化的警告无法从命令行中禁用。相反,您必须在Java代码中的每个地方手动添加@SuppressWarnings
注释未经检查的转换。