如何改变蚂蚁编译JDK 1.6 [英] How to change Ant compiler to JDK 1.6

查看:193
本文介绍了如何改变蚂蚁编译JDK 1.6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要编译我的源$ C ​​$ C是与JRE 1.6兼容。然而,当我尝试设置javac任务的编译器属性是javac1.6,蚂蚁仍然编译我的code。与javac1.7。我也曾尝试设置编译器的版本是现代的,并没有帮助。

I need to compile my source code to be compatible with jre 1.6. However, when I attempt to set the compiler attribute of the javac task to be javac1.6, ant will still compile my code with javac1.7. I have also tried setting the compiler version to be "modern" and that did not help.

<target name="compile-tests">
    <javac compiler="javac1.6" includeantruntime="false" srcdir="${test.dir}"
     destdir="${build.dir}" >
        <classpath refid="class.path" />
    </javac>
</target>

我的JAVA_HOME设置为JDK 1.6:

My JAVA_HOME is set to JDK 1.6:

echo $JAVA_HOME </code> gives: <code>
/usr/lib/jvm/java-6-openjdk-amd64/

我的蚂蚁版本是:
    Apache Ant的(TM)1.8.2版本

My ant version is: Apache Ant(TM) version 1.8.2

根据这个帖子,蚂蚁用途自己的编译器。我如何重写默认的蚂蚁?
此外,根据<一href=\"http://stackoverflow.com/questions/235363/override-the-compiler-attribute-in-an-ant-javac-task\">this帖子和蚂蚁的文件,我可以设置全局build.compiler财产。我该怎么设置该属性是,我怎么可能做到呢?

According to this post, ant uses its own compiler. How do I override the ant default? Also, according to this post and the ant documentation, I can set the global build.compiler property. What do I set that property to be and how might I do that?

推荐答案

我觉得蚂蚁编译属性只是知道哪些属性由编译器支持。在一般的javac 属性或选项传递到编译器是目标

I think Ant compiler attribute is just to know which properties are supported by the compiler. In javac in general the attribute or option to pass to the compiler is target.

您甚至不应该需要有安装了Java 6的编译器。

You should not even need to have a Java 6 compiler installed.

这篇关于如何改变蚂蚁编译JDK 1.6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆