0
我是新建Ant構建腳本。我嘗試做以下的事情螞蟻沒有創建目錄
- 刪除build目錄
- 創建構建目錄
- 編譯代碼
- 爲每個包項目
這個jar文件我寫了以下代碼
<?xml version="1.0"?>
<project name="test" basedir=".">
<property name="build.lib" value="dist"/>
<property name="prefix" value="XXX"/>
<property name="src.dir" value="src"/>
<property name="build.dir" value="build"/>
<property name="build.classes" value="${build.dir}/classes"/>
<property name="jar.dir" value="${build.dir}/jar"/>
<path id="compile.classpath">
<fileset dir="OpenJPA_lib_jar">
<include name="*.jar"/>
</fileset>
</path>
<macrodef name="build_jar">
<attribute name="name"/>
<sequential>
<jar destfile="${build.lib}/${prefix}[email protected]{name}.jar">
<fileset dir="${build.classes}">
<include name="zumigo/geofence/@{name}/**"/>
</fileset>
</jar>
</sequential>
</macrodef>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<echo message="Build dir = ${build.dir}"/>
<target name="prepare">
<mkdir dir="${build.dir}"/>
</target>
<target name="compile" depends="prepare">
<javac destdir="${build.classes}" debug="true" srcdir="${src.dir}">
<classpath refid="compile.classpath"/>
</javac>
</target>
<target name="run" depends="compile">
<build_jar name="common"/>
<build_jar name="dal"/>
<build_jar name="databeans"/>
<build_jar name="dataobject"/>
<build_jar name="dto"/>
<build_jar name="exception"/>
</target>
</project>
當我執行與詳細選項命令行ant腳本它給了我下面的輸出
Apache Ant(TM) version 1.8.3 compiled on February 26 2012
Trying the default build file: build.xml
Buildfile: E:\XXX\XXXWorkspaces\GeoFence\v1.0\GeoFence_Java\build.xml
Detected Java version: 1.6 in: C:\Program Files\Java\jdk1.6.0_14\jre
Detected OS: Windows XP
parsing buildfile E:\XXX\XXXWorkspaces\GeoFence\v1.0\GeoFence_Java\build.xml with URI = file:/E:/XXX/XXXWorkspaces/GeoFence/v1.0/GeoFence_Java/build.xml
Project base dir set to: E:\XXX\XXXWorkspaces\GeoFence\v1.0\GeoFence_Java
parsing buildfile jar:file:/D:/Downloads/apache-ant-1.8.3/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/D:/Downloads/apache-ant-1.8.3/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
[macrodef] creating macro build_jar
[echo] Build dir = build
BUILD SUCCESSFUL
Total time: 0 seconds
我甚至嘗試調試Eclipse中的腳本。調試點設置在「準備」目標,當我們按下F5時,它退出調試。它不顯示任何錯誤消息。
任何人都可以讓我知道腳本中出了什麼問題嗎?
我想你應該在標籤中提供一個默認目標? –
vaisakh