当我尝试使用 ant 构建项目时出现错误。这是构建文件:
<?xml version="1.0" encoding="UTF-8"?>
<project name="GPClient" default="dist" basedir=".">
<description>
simple example build file
</description>
<!-- set global properties for this build -->
<dirname property="client.basedir" file="${ant.file.GPClient}"/>
<property name="client.src" location="${client.basedir}/src"/>
<property name="client.build" location="${client.basedir}/build"/>
<property name="client.dist" location="${client.basedir}/dist"/>
<property name="client.done" location="${client.basedir}/done"/>
<property name="client.app" location="${client.basedir}/app"/>
<property name="client.webinf_classes" location="${client.basedir}/WEB-INF/classes"/>
<property name="server.dir" location="${client.basedir}/../GrahamsProjServer"/>
<property name="deploy.location" location="${client.basedir}/../../jboss-as-7.1.1.Final/standalone/deployments"/>
<path id="lib.classpath">
<fileset dir="${client.basedir}">
<include name="/lib/*.jar"/>
<!-- <exclude name="jboss-servlet-api_3.0_spec-1.0.0.Final.jar" /> -->
</fileset>
<!-- <fileset dir="${client.basedir}/properties">
<include name="*.properties"/>
</fileset>
<fileset dir="${server.dir}/dist">
<include name="*.jar"/>
</fileset>
<fileset dir="${client.basedir}/WEB-INF/lib">
<include name="*.jar"/>
</fileset> -->
</path>
<path id="server.classpath">
<fileset dir="${server.dir}/dist">
<include name="*.jar"/>
</fileset>
</path>
<path id="mf.classpath">
<path refid="${lib.classpath}"/>
<path refid="${server.classpath}"/>
</path>
<path id="war.classpath">
<fileset dir="${client.basedir}/WEB-INF/lib">
<include name="*.jar"/>
</fileset>
</path>
<target name="client.init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${client.build}"/>
<mkdir dir="${client.dist}"/>
<mkdir dir="${client.done}"/>
<mkdir dir="${client.app}"/>
<mkdir dir="${client.webinf_classes}"/>
<mkdir dir="${client.webinf_classes}/grahamsprojclient/servlet"/>
</target>
<target name="client.compile" depends="client.init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${dist} -->
<javac srcdir="${client.src}" destdir="${client.dist}" >
<classpath>
<path refid="mf.classpath"/>
</classpath>
</javac>
</target>
<target name="client.package" depends="client.compile" description="create the jar">
<!-- <manifestclasspath property="manifest.path" jarfile="${dist}/GrahamsProjClient.jar">
<classpath refid="mf.classpath"/>
</manifestclasspath> -->
<jar destfile="${client.app}/GrahamsProjClient.jar" basedir="${client.dist}" >
<fileset dir="${client.basedir}/properties">
<include name="*.properties"/>
</fileset>
<fileset dir="${client.basedir}">
<include name="lib/*.jar"/>
<!-- <exclude name="lib/jboss-servlet-api_3.0_spec-1.0.0.Final.jar" />-->
</fileset>
<manifest>
<attribute name="Class-Path" value="${mf.classpath}"/>
<attribute name="Main-Class" value="grahamsprojclient.main.Start"/>
</manifest>
</jar>
</target>
<!--<target name="deploy" depends="package"
description="generate the distribution" >
<ear destfile="${deploy.location}/GrahamsProjServer.ear" appxml="${client.basedir}/META-INF/application.xml" >
<metainf dir="${client.basedir}/META-INF"/>
<fileset dir="${dist}" includes="*.jar"/>
</ear>
</target> -->
<target name="client.clean"
description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${client.build}"/>
<delete dir="${client.dist}"/>
<delete dir="${client.app}"/>
<delete dir="${client.done}"/>
<delete dir="${client.webinf_classes}"/>
<echo message="Deleting files in ${deploy.location}"/>
<delete>
<fileset dir="${deploy.location}" >
<exclude name="*.txt" />
</fileset>
</delete>
</target>
<target name="client.compile-war-lib">
<mkdir dir="WEB-INF/classes"/>
<javac srcdir="${client.src}" destdir="WEB-INF/classes" debug="true" includeAntRuntime="false">
<classpath refid="war.class.path"/>
<include name="**/*.java"/>
</javac>
</target>
<target name="client.compile-war" depends="client.init" description="compile the source " >
<!-- Compile the java code from ${src} into ${dist} -->
<javac srcdir="${client.basedir}/src/grahamsprojclient/servlet"
destdir="${client.basedir}/WEB-INF/classes/grahamsprojclient/servlet" >
<classpath>
<path refid="war.class.path"/>
</classpath>
</javac>
</target>
<target name="client.build_war" depends="client.package, client.compile-war" description="build war" >
<war destfile="${client.done}/GrahamsProjClient.war" webxml="WEB-INF/web.xml">
<metainf dir="${client.basedir}/META-INF" includes="context.xml" />
<lib dir="${client.basedir}/WEB-INF/lib">
<exclude name="/CopyLibs"/>
<exclude name="*.ex" />
</lib>
<classes dir="${client.basedir}/WEB-INF/classes/grahamsprojclient/servlet" >
<exclude name="*.java" />
</classes>
<fileset dir="${client.basedir}" >
<include name="GrahamsProjClient-webstart.jnlp"/>
<include name="app/GrahamsProjClient.jar"/>
<include name="GrahamsProjStartAppPage.html"/>
<!-- <include name="lib/*.jar"/>
<include name="lib/jboss-servlet-api_3.0_spec-1.0.0.Final.jar"/> -->
</fileset>
</war>
</target>
<target name="client.deploy_war" depends="client.build_war" description="deploy war">
<copy file="${client.done}/GrahamsProjClient.war" todir="${deploy.location}" />
</target>
</project>
这是 ant 构建日志(底部有错误):
client.init:
Created dir: C:\Users\gbaldeck\Google Drive\Work\LearningAS7\GrahamsProjClient\build
Created dir: C:\Users\gbaldeck\Google Drive\Work\LearningAS7\GrahamsProjClient\dist
Created dir: C:\Users\gbaldeck\Google Drive\Work\LearningAS7\GrahamsProjClient\done
Created dir: C:\Users\gbaldeck\Google Drive\Work\LearningAS7\GrahamsProjClient\app
Created dir: C:\Users\gbaldeck\Google Drive\Work\LearningAS7\GrahamsProjClient\WEB-INF\classes
Created dir: C:\Users\gbaldeck\Google Drive\Work\LearningAS7\GrahamsProjClient\WEB-INF\classes\grahamsprojclient\servlet
client.compile:
C:\Users\gbaldeck\Google Drive\Work\LearningAS7\GrahamsProjClient\build-client.xml:67: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
Compiling 6 source files to C:\Users\gbaldeck\Google Drive\Work\LearningAS7\GrahamsProjClient\dist
Unresolvable reference ${lib.classpath} might be a misuse of property expansion syntax.
C:\Users\gbaldeck\Google Drive\Work\LearningAS7\GrahamsProjClient\build-client.xml:67: Reference ${lib.classpath} not found.
BUILD FAILED (total time: 0 seconds)
是什么导致这种情况发生?我没有看到我的路径设置有什么问题。