build.xml - javac ; Ant

メモ

  • ant debug をしたい
  • 他のモジュールのパッケージをコンパイル対象にしたい

ex.

UnitTest モジュールから SampleApp のパッケージを読み込まなければいけない

  • {アプリルート}/SampleApp
  • {〃}/UnitTest

上2つのモジュールがあり、UnitTest モジュールの build.xmlを編集する

  <property name="src.dir"     location="src/jp/matsu" />
  <property name="bin.dir"     location="bin" />
  <property name="app.src.dir" location="../SampleApp/src/jp/matsu/SampleApp" />

  <!-- setting classpath -->
  <path id="classpath">
    <pathelement location="../SampleApp/libs" />
  </path>

  <!-- setting javac -->
  <javac target="1.7" debug="true" srcdir="${src.dir}" destdir="${bin.dir}">
    <classpath refid="classpath" />
    <src path="${app.src.dir.parent}" />
  </javac>