環境:Mac OSX 10.7.5、Eclipse 4.2.1、ApacheAntバージョン1.8.2
EclipseでサンプルのHelloWorldプログラムを作成し、プロジェクトをbuild.xmlファイルにエクスポートしました。
プロンプトで次のように入力します。
$ ant
ビルドファイル:/Users/cspam/Documents/workspace/TestHelloWorld/build.xml
ビルドサブプロジェクト:
初期化:
build-project:[echo] TestHelloWorld:/Users/cspam/Documents/workspace/TestHelloWorld/build.xml
建てる:
成功を収める
しかし、私が探しているビルドディレクトリは作成されていません。これが私のxmlファイルです:
<project basedir="." default="build" name="TestHelloWorld">
<property environment="env"/>
<property name="ECLIPSE_HOME" value="../../eclipse"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.6"/>
<property name="source" value="1.6"/>
<path id="TestHelloWorld.classpath">
<pathelement location="bin"/>
</path>
<target name="init">
<mkdir dir="bin"/>
<copy includeemptydirs="false" todir="bin">
<fileset dir="src">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="clean">
<delete dir="bin"/>
</target>
<target name="cleanall" depends="clean"/>
<target name="build" depends="build-subprojects,build-project"/>
<target name="build-subprojects"/>
<target name="build-project" depends="init">
<echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="bin" includeantruntime="false" source="${source}" target="${target}">
<src path="src"/>
<classpath refid="TestHelloWorld.classpath"/>
</javac>
</target>
<target name="build-refprojects" description="Build all projects which reference this project. Useful to propagate changes."/>
<target name="init-eclipse-compiler" description="copy Eclipse compiler jars to ant lib directory">
<copy todir="${ant.library.dir}">
<fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
</copy>
<unzip dest="${ant.library.dir}">
<patternset includes="jdtCompilerAdapter.jar"/>
<fileset dir="${ECLIPSE_HOME}/plugins" includes="org.eclipse.jdt.core_*.jar"/>
</unzip>
</target>
<target name="build-eclipse-compiler" description="compile project with Eclipse compiler">
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
<antcall target="build"/>
</target>
私はAntを使うのは初めてです-ですから、これは私にとってまったく新しいことです。「Build」ディレクトリを作成する必要があると言われましたが、作成されません。私が何をしているのかわからないので、ポインタ/ヘルプ/提案をいただければ幸いです。
更新:@Cliffが提案したように。これは、ant-cleanを実行した後のantの出力です。
ビルドファイル:/Users/cspam/Documents/workspace/TestHelloWorld/build.xml
ビルドサブプロジェクト:
init:[mkdir]作成されたディレクトリ:/ Users / cspam / Documents / worksheet / TestHelloWorld / bin
build-project:[echo] TestHelloWorld:/Users/cspam/Documents/workspace/TestHelloWorld/build.xml[javac]2つのソースファイルを/Users/ cspam / Documents / worksheet / TestHelloWorld/binにコンパイルします
建てる:
BUILD SUCCESSFUL合計時間:0秒
.classファイルは実際にクリーンアップ後に作成されたようです。Eclipse内から「build.xml」ファイルを右クリックして「実行」->「Antビルド」を実行しても、同じことが正常に実行されます。
現在、このxmlファイルをBambooにプッシュして、クリーンな実行が可能かどうかを確認しています。これは簡単なプロセスですか?助けてくれてありがとう。