解决ant编译时的includeantruntime警告

作者: harde 分类: Java,开发相关 发布时间: 2014-12-03 10:18

不知道什么时候开始,用ant编译代码时总会提示一条“warning: ‘includeantruntime’ was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds”
一直以来也没注意(不重视warning的确需要改一改……不过中方这边不负责deploy也是一个原因~~)

按照提示,在配置文件中的”javac”节点加入 includeantruntime=”false” 属性,提示消失,但是为什么会出现这个警告呢?

本着有事找文档的原则,在这里http://ant.apache.org/manual/Tasks/javac.html
发现了介绍:
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.
但是,还是没告诉我为什么出现了这个警告。
于是咱继续Google
在这里:http://cyf0110.iteye.com/blog/1704832
又发现了一段话:

这个警告是从 Ant1.8 才开始有的,我现在用的 Eclipse 是 3.8M1,内置了 Ant1.8.2

历史上,Ant 总会把它自己的 runtime包含进对 javac 任务可见的 classpath中。因此,任何与Ant有关的库都会自动进入你的构建类路径,不管你是否需要它们。这对大部分人来说可能是没必要的,因此,新的Ant版本提供了这个选项。新版本不提供默认值是为了保证早期构建文件的可移植性,即在不同Ant版本下,构建文件都能保持一致的行为。

原来如此,好了,问题解决了,原因也清楚了。

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注