蚂蚁警告:“‘includeantruntime‘未设置”

本文翻译自:ant warning: “'includeantruntime' was not set”

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? 这是什么意思?


#1楼

参考:https://stackoom.com/question/LPce/蚂蚁警告-includeantruntime-未设置


#2楼

Use <property name="build.sysclasspath" value="last"/> in your build.xml file 在build.xml文件中使用<property name="build.sysclasspath" value="last"/>

For more details search includeAntRuntime in Ant javac 有关详细信息,请在Ant javac中搜索includeAntRuntime

Other possible values could be found here 其他可能的值可以在这里找到


#3楼

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. 有一个更新已安装jdk1.8与eclipse中的ant的旧设置(jdk1.6.0)不兼容。 I install that update. 我安装了这个更新。 right now, my ant project is build success. 现在,我的蚂蚁项目取得了成功。

Try it, hope this will be helpful. 试试吧,希望这会有所帮助。


#4楼

Ant Runtime 蚂蚁运行时

Simply set includeantruntime="false" : 只需设置includeantruntime="false"

<javac includeantruntime="false" ...>...</javac>

If you have to use the javac -task multiple times you might want to consider using PreSetDef to define your own javac -task that always sets includeantruntime="false" . 如果必须多次使用javac -task,则可能需要考虑使用PreSetDef来定义自己的javac -task,它始终设置includeantruntime="false"

Additional Details 额外细节

From http://www.coderanch.com/t/503097/tools/warning-includeantruntime-was-not-set : 来自http://www.coderanch.com/t/503097/tools/warning-includeantruntime-was-not-set

That's caused by a misfeature introduced in Ant 1.8. 这是由Ant 1.8中引入的错误引起的。 Just add an attribute of that name to the javac task, set it to false, and forget it ever happened. 只需将该名称的属性添加到javac任务,将其设置为false,并忘记它曾发生过。

From http://ant.apache.org/manual/Tasks/javac.html : 来自http://ant.apache.org/manual/Tasks/javac.html

Whether to include the Ant run-time libraries in the classpath; 是否在类路径中包含Ant运行时库; defaults to yes, unless build.sysclasspath is set. 默认为yes,除非设置了build.sysclasspath。 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. 通常最好将其设置为false,以便脚本的行为对运行它的环境不敏感。


#5楼

Chet Hosey wrote a nice explanation here : Chet Hosey 在这里写了一个很好的解释:

Historically, Ant always included its own runtime in the classpath made available to the javac task. 从历史上看,Ant总是将自己的运行时包含在可用于javac任务的类路径中。 So any libraries included with Ant, and any libraries available to ant, are automatically in your build's classpath whether you like it or not. 因此,Ant中包含的任何库以及ant可用的任何库都会自动出现在构建的类路径中,无论您是否喜欢它。

It was decided that this probably wasn't what most people wanted. 决定这可能不是大多数人想要的。 So now there's an option for it. 所以现在有一个选择。

If you choose "true" (for includeantruntime), then at least you know that your build classpath will include the Ant runtime. 如果选择“true”(对于includeantruntime),那么至少你知道你的构建类路径将包含Ant运行时。 If you choose "false" then you are accepting the fact that the build behavior will change between older versions and 1.8+. 如果选择“false”,那么您接受这样的事实:构建行为将在旧版本和1.8+之间发生变化。

As annoyed as you are to see this warning, you'd be even less happy if your builds broke entirely. 正如你要看到这个警告一样恼火,如果你的构建完全破坏,你会更不高兴。 Keeping this default behavior allows unmodified build files to work consistently between versions of Ant. 保持此默认行为允许未修改的构建文件在Ant版本之间保持一致。


#6楼

The answer from Daniel works just perfect. 丹尼尔的答案非常完美。 Here is a sample snippet that I added to my build.xml: 这是我添加到build.xml的示例代码段:

<target name="compile">
    <mkdir dir="${classes.dir}"/>
    <javac srcdir="${src.dir}" destdir="${classes.dir}" includeantruntime="false">
                                                 <!--   ^^^^^^^^^^^^^^^^^^^^^^^^^  -->
        <classpath>
            <path id="application" location="${jar.dir}/${ant.project.name}.jar"/>
            <path id="junit" location="${lib.dir}/junit-4.9b2.jar"/>
        </classpath>
    </javac>
</target>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值