蚂蚁警告:““includeantruntime”未设置”
我收到以下警告:
[javac] build.xml:9: warning: 'includeantruntime' was not set,
defaulting to build.sysclasspath=last; set to false for repeatable builds
这是什么意思?
I receive the following warning:
[javac] build.xml:9: warning: 'includeantruntime' was not set,
defaulting to build.sysclasspath=last; set to false for repeatable builds
What does this mean?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
Ant Runtime
只需设置
includeantruntime="false"
:如果您必须多次使用
javac
任务,您可能需要考虑使用PreSetDef
定义您自己的javac
-task,该任务始终设置 <代码>includeantruntime="false"。其他详细信息
来自 http://www.coderanch.com/ 的 t/503097/tools/warning-includeantruntime-was-not-set:
来自 http://ant.apache.org/manual/Tasks/javac.html:
Ant Runtime
Simply set
includeantruntime="false"
:If you have to use the
javac
-task multiple times you might want to consider usingPreSetDef
to define your ownjavac
-task that always setsincludeantruntime="false"
.Additional Details
From http://www.coderanch.com/t/503097/tools/warning-includeantruntime-was-not-set:
From http://ant.apache.org/manual/Tasks/javac.html:
正如 @Daniel Kutik 提到的,
presetdef
是一个很好的选择选项。特别是如果您正在处理一个包含许多build.xml
文件的项目,而这些文件无法或不愿意编辑(例如,来自第三方的文件)。要使用
presetdef
,将这些行添加到您的顶级build.xml
文件中:现在,所有后续
javac
任务本质上都会继承includeantruntime="false"
。如果您的项目确实需要 ant 运行时库,您可以将它们显式添加到构建文件中或设置includeantruntime="true"
。后者也将消除警告。如果需要,后续的 javac 任务仍然可以显式更改此设置,例如:
我建议不要使用 ANT_OPTS。它有效,但它违背了警告的目的。该警告告诉人们,一个人的构建可能在另一个系统上表现不同。使用 ANT_OPTS 使这种情况变得更有可能,因为现在每个系统都需要以相同的方式使用 ANT_OPTS。此外,
ANT_OPTS
将全局应用,在您的所有项目中随意抑制警告As @Daniel Kutik mentioned,
presetdef
is a good option. Especially if one is working on a project with manybuild.xml
files which one cannot, or prefers not to, edit (e.g., those from third-parties.)To use
presetdef
, add these lines in your top-levelbuild.xml
file:Now all subsequent
javac
tasks will essentially inheritincludeantruntime="false"
. If your projects do actually need ant runtime libraries, you can either add them explicitly to your build files OR setincludeantruntime="true"
. The latter will also get rid of warnings.Subsequent
javac
tasks can still explicitly change this if desired, for example:I'd recommend against using
ANT_OPTS
. It works, but it defeats the purpose of the warning. The warning tells one that one's build might behave differently on another system. UsingANT_OPTS
makes this even more likely because now every system needs to useANT_OPTS
in the same way. Also,ANT_OPTS
will apply globally, suppressing warnings willy-nilly in all your projectsChet Hosey 写了一个很好的解释< a href="http://ant.1045680.n5.nabble.com/warning-includeantruntime-was-not-set-tp2639463p2639765.html" rel="noreferrer">此处:
Chet Hosey wrote a nice explanation here:
丹尼尔的回答非常完美。以下是我添加到 build.xml 中的示例片段:
The answer from Daniel works just perfect. Here is a sample snippet that I added to my build.xml:
如果您像我一样从命令行工作,那么快速的答案是执行
然后再次运行您的 ant 脚本。
If you like me work from commandline the quick answer is executing
And then run your ant script again.
在 build.xml 文件中使用
有关更多详细信息,请在 Ant javac
可以找到其他可能的值 此处
Use
<property name="build.sysclasspath" value="last"/>
in your build.xml fileFor more details search
includeAntRuntime
in Ant javacOther possible values could be found here
我也遇到了同样的问题,我检查了程序和功能。安装了 jdk1.8 的更新,它与 eclipse 中 ant 的旧设置(jdk1.6.0)不兼容。
我安装该更新。
现在,我的ant项目正在构建成功。
尝试一下,希望这会有所帮助。
i faced this same, i check in in program and feature. there was an update has install for jdk1.8 which is not compatible with my old setting(jdk1.6.0) for ant in eclipse.
I install that update.
right now, my ant project is build success.
Try it, hope this will be helpful.