解決ant編譯中出現“includeantruntime was not set”警告的問題

執行ant編譯時,總會出現如下的警告:
[javac] D:\SnowPad\build.xml:26: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
雖然不影響編譯,但還是解決才安心。其實解決方法也很簡單,只需要根據提示在javac任務中添加includeAntRuntime="false"屬性即可。例如:
修改前:
    <javac srcdir="${srcDir}" destdir="${binDir}" />
修改後:
    <javac srcdir="${srcDir}" destdir="${binDir}" includeAntRuntime="false" />
注:
1.對於includeAntRuntime屬性,官方的解釋如下:
    Whether to include the Ant run-time libraries in the classpath; defaults to yes, unless build.sysclasspath is set. It is usually best to set this to false so the script's behavior is not sensitive to the environment in which it is run.
2.此警告在較早的ant版本中可能不會出現,當前用的版本是:Apache Ant(TM) version 1.8.2 compiled on December 20 2010。所以此問題跟ant版本有關。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章