Loading...

apacheant编译中出现“includeantruntime was not set”警告的问题?

–>

最近学习apache-ant运行的时候出现警告:


警告:

D:\>ant run
Buildfile: D:\build.xml
clean:
   [delete] Deleting directory D:\build
compile:
    [mkdir] Created dir: D:\build\classes
    [javac] D:\build.xml:126: warning: ‘includeantruntime’ was not set, defaulti
ng to build.sysclasspath=last; set to false for repeatable builds

    [javac] Compiling 1 source file to D:\build\classes
run:
     [java] study-apache-ant-Demo
BUILD SUCCESSFUL
Total time: 0 seconds

解决办法:

<project name=”javaTest” default=”run” basedir=”.”>
<target name=”clean” description=”清除目录”>
<delete dir=”build”/>
</target>

<target name=”compile” depends=”clean” description=”编译”>
<mkdir dir=”build/classes”/>
<javac srcdir=”src” destdir=”build/classes”
includeantruntime=”on”
/>
</target>

<target name=”run” depends=”compile” description=”运行”>
<java classname=”Demo”>
<classpath>
<pathelement path=”build/classes”/>
</classpath>
</java>
</target>
</project>

也就是添加 includeantruntime=”on” 。有的添加 includeAntRuntime=”false”,

有的添加includeantruntime=”20000″


注:
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版本有关。


我用的ant版本:Apache Ant(TM) version 1.9.9 compiled on February 2 2017



本文来源 互联网收集,文章内容系作者个人观点,不代表 本站 对观点赞同或支持。如需转载,请注明文章来源,如您发现有涉嫌抄袭侵权的内容,请联系本站核实处理。

© 版权声明

相关文章