[英]How to add commands to Ant build xml
I would like to run the command javac -version
when the Ant does it build on Linux. 当Ant在Linux上构建时,我想运行命令javac -version
。 I did a bit of reading and wrote my xml as follows: 我做了一些阅读,并将我的xml编写如下:
<javac srcdir="SourceDir" destdir="DestDir" executable="${env.JAVA_HOME}">
<classpath>
....
</classpath>
<compilerarg value="javac -version"/>
</javac>
But i get an error as follows: 但我得到如下错误:
[javac] javac: invalid flag: javac -version
[javac] Usage: javac <options> <source files>
[javac] use -help for a list of possible options
What is the issue? 有什么问题 How can i make Ant print the jdk version that it is using when running the javac command. 运行javac命令时,如何使Ant打印正在使用的jdk版本。 Thanks in advance! 提前致谢!
<project>
<echo>Java Version via Ant: ${ant.java.version}</echo>
<echo>Java Version System Prop: ${java.version}</echo>
</project>
or 要么
<target name="print-version">
<echo>Java/JVM version: ${ant.java.version}</echo>
<echo>Java/JVM detail version: ${java.version}</echo>
</target>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.