Recent learning Apache-ant run with a warning:
Warning:
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 ' is 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
Solution:
<project name= "Javatest" default= "Run" basedir= "." >
<target name= "clean" description= "Clear Catalog" >
<delete dir= "Build"/>
</target>
<target name= "Compile" depends= "clean" description= "compiling" >
<mkdir dir= "Build/classes"/>
<javac srcdir= "src" destdir= "build/classes" includeantruntime= "on"/>
</target>
<target name= "Run" depends= "compile" description= "Running" >
<java classname= "Demo" >
<classpath>
<pathelement path= "Build/classes"/>
</classpath>
</java>
</target>
</project>
That is, add Includeantruntime= "on". Some add Includeantruntime= "false",
Some add includeantruntime= "20000"
Note:
1. For the Includeantruntime attribute, the official explanation is as follows:
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 isn't sensitive to the environment in which it is run.
2. This warning may not occur in an earlier ANT version, and the current version is: Apache Ant (TM) version 1.8.2 compiled on December 20 2010. So this problem is related to the ant version.
My ant version: Apache ant (TM) version 1.9.9 compiled on February 2 2017