Ant构建设置javac的位置 [英] ant buildfile setting javac location
问题描述
我编辑旧项目的构建文件。当我加入一些jar文件到项目中使用Java 1.6,它不会建。它说
I'm editing the buildfile of an old project. When I add some jar files to the project that use Java 1.6, it won't build. It says
[javac] javac: invalid target release: 1.6
所以很明显我需要告诉Ant构建使用javac的1.6。
So clearly I need to tell the ant buildfile to use javac 1.6.
我如何做到这一点?我有我的系统上安装JDK1.6,但默认的javac是1.5。我不想更改默认的javac ...我只是想设置在这一个proejct到JDK1.6 /斌/ javac的javac的位置。 如何办这在Ant构建的XML?
How do I do this? I have JDK1.6 installed on my system, but the default javac is 1.5. I don't want to change the default javac... I just want to set the javac location in this one proejct to JDK1.6/bin/javac. How do I do this in the XML of an ant buildfile?
谢谢,结果
KTM
Thanks,
ktm
推荐答案
您可以创建您更改包装脚本你的 JAVA_HOME
执行之前蚂蚁
。
You can create a wrapper script in which you change your JAVA_HOME
before executing ant
.
例如。 build.sh
export JAVA_HOME=/path/to/jdk1.6
ant "$@"
现在,当你调用 build.sh
它将使用的Java6对于的javac
, java的
和任何其他命令。
Now when you call build.sh
it will use java6 for both javac
, java
and any other commands.
IMO这比用摆弄更好的build.xml
(和分叉一个新的的javac
工艺)。
IMO this is better than fiddling with the build.xml
(and forking a new javac
process).
这篇关于Ant构建设置javac的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!