参考:http://taink.iteye.com/blog/599735
- <!-- 指定环境变量参数为:SystemVariable -->
- <property environment="SystemVariable" />
- <!-- 将tomcat.home指向环境变量TOMCAT_HOME指向的路径 -->
- <property name="tomcat.home" value="${SystemVariable.TOMCAT_HOME}" />
- <target name="display">
- <echo message="${tomcat.home}" />
- <mkdir dir="${tomcat.home}/test"/>
- </target>
- <property name="manager.url" value="http://localhost:8080/manager"/>
- <!-- 指定环境变量参数为:SystemVariable -->
- <property environment="SystemVariable" />
- <!-- 将tomcat.home指向环境变量TOMCAT_HOME指向的路径 -->
- <property name="java.home" value="${SystemVariable.JAVA_HOME}" />
- <target name="compile">
- <echo message="${java.home}" />
- <javac srcdir="${src}"
- <classpath id="classpath">
- <fileset dir="${java.home}\lib"><!--读取环境变量中的JAVA_HOME设置ant-->
- <include name="**/*.jar"/>
- </fileset>
- <fileset dir="${lib}">
- <include name="**/*.jar"/>
- </fileset>
- </classpath>
- </javac>
- </target>
本文转自xwdreamer博客园博客,原文链接:http://www.cnblogs.com/xwdreamer/archive/2011/11/21/2296929.html,如需转载请自行联系原作者