2011-10-13 87 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 \>標記之前的構建腳本中。添加編譯器參數以避免上面的錯誤,你應該很好。

相關問題