2011-10-13 117 views
3

可能重复:
Javac: Treat warnings as errors失败的警告

我想更新我的Android项目的ANT脚本失败的警告,但似乎无法找到我会怎么做(我找不到更新的javac元素)。我认为这是可能的?

为了清楚起见,我不想在Eclipse中这样做,因为我希望我们的构建系统在有人引入新警告时失败。

+1

我不明白为什么这是关闭的 - 这个主题是针对Android的,因为解决的真正问题是在哪里找到需要编辑的javac任务 –

回答

1

要了解如何在ant中执行此操作,请参阅:Javac: Treat warnings as errors。从该链接:

<javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath"> 
    <compilerarg value="-Werror"/> 
</javac> 

Android隐藏您的javac任务。如果你使用当前SDK创建一个新的Android项目,该build.xml文件将对如何编辑特定目标的描述:

 The rules file is imported from 
     <SDK>/tools/ant/ 
    Depending on the project type it can be either: 
    - main_rules.xml 
    - lib_rules.xml 
    - test_rules.xml 

    To customize existing targets, there are two options: 
    - Customize only one target: 
     - copy/paste the target into this file, *before* the 
      <setup> task. 
     - customize it to your needs. 
    - Customize the whole script. 
     - copy/paste the content of the rules files (minus the top node) 
      into this file, *after* the <setup> task 
     - disable the import of the rules by changing the setup task 
      below to <setup import="false" />. 
     - customize to your needs. 

您需要打开main_rules.xml文件(或者,如果你正在建设一个lib_rules库),请复制<target name="compile">部分,然后将其粘贴到<setup \>标记之前的构建脚本中。添加编译器参数以避免上面的错误,你应该很好。

相关问题