2fc3991
<project name="doxia-core" default="jar" basedir=".">
2fc3991
  <property file="${user.home}/.m2/maven.properties"/>
2fc3991
  <property name="maven.build.output" value="target/classes"/>
2fc3991
  <property name="maven.build.directory" value="target"/>
2fc3991
  <property name="maven.build.final.name" value="doxia-core-1.0-alpha-7"/>
2fc3991
  <property name="maven.test.reports" value="${maven.build.directory}/test-reports"/>
2fc3991
  <property name="maven.test.output" value="target/test-classes"/>
2fc3991
  <property name="maven.repo.local" value="${user.home}/.m2/repository"/>
2fc3991
  <path id="build.classpath">
2fc3991
    <fileset dir="../lib">
2fc3991
      <include name="classworlds.jar"/>
2fc3991
      <include name="plexus_utils.jar"/>
2fc3991
      <include name="plexus_container-default.jar"/>
2fc3991
      <include name="oro.jar"/>
2fc3991
      <include name="doxia-sink-api.jar"/>
2fc3991
    </fileset>
2fc3991
  </path>
2fc3991
  <target name="clean" description="Clean the output directory">
2fc3991
    <delete dir="${maven.build.directory}"/>
2fc3991
  </target>
2fc3991
  <target name="compile" depends="get-deps" description="Compile the code">
2fc3991
    <mkdir dir="${maven.build.output}"/>
2fc3991
    <javac destdir="${maven.build.output}" excludes="**/package.html" debug="true" deprecation="true" optimize="false">
2fc3991
      <src>
2fc3991
        <pathelement location="src/main/java"/>
2fc3991
      </src>
2fc3991
      <classpath refid="build.classpath"/>
2fc3991
    </javac>
2fc3991
    <copy todir="${maven.build.output}">
2fc3991
      <fileset dir="src/main/resources"/>
2fc3991
    </copy>
2fc3991
  </target>
2fc3991
2fc3991
  <target name="jar" depends="compile,test" description="Clean the JAR">
2fc3991
    <jar jarfile="${maven.build.directory}/${maven.build.final.name}.jar" basedir="${maven.build.output}" excludes="**/package.html"/>
2fc3991
  </target>
2fc3991
  <target name="compile-tests" depends="junit-present, compile" description="Compile the test code" if="junit.present">
2fc3991
    <mkdir dir="${maven.test.output}"/>
2fc3991
    <javac destdir="${maven.test.output}" excludes="**/package.html" debug="true" deprecation="true" optimize="false">
2fc3991
      <src>
2fc3991
        <pathelement location="src/test/java"/>
2fc3991
      </src>
2fc3991
      <classpath>
2fc3991
        <path refid="build.classpath"/>
2fc3991
        <pathelement location="${maven.build.output}"/>
2fc3991
      </classpath>
2fc3991
    </javac>
2fc3991
    <copy todir="${maven.test.output}">
2fc3991
      <fileset dir="src/test/resources"/>
2fc3991
    </copy>
2fc3991
  </target>
2fc3991
  <target name="test" depends="junit-present, compile-tests" if="junit.present" description="Run the test cases">
2fc3991
    <mkdir dir="${maven.test.reports}"/>
2fc3991
    <junit printSummary="yes" haltonerror="false" haltonfailure="false" fork="true" dir=".">
2fc3991
      <sysproperty key="basedir" value="."/>
2fc3991
      <formatter type="xml"/>
2fc3991
      <formatter type="plain" usefile="false"/>
2fc3991
      <classpath>
2fc3991
        <path refid="build.classpath"/>
2fc3991
        <pathelement location="${maven.build.output}"/>
2fc3991
        <pathelement location="${maven.test.output}"/>
2fc3991
      </classpath>
2fc3991
      <batchtest todir="${maven.test.reports}">
2fc3991
        <fileset dir="src/test/java">
2fc3991
          <include name="**/*Test.java"/>
2fc3991
          <exclude name="**/*Abstract*Test.java"/>
2fc3991
        </fileset>
2fc3991
      </batchtest>
2fc3991
    </junit>
2fc3991
  </target>
2fc3991
  <target name="test-junit-present">
2fc3991
    <available classname="junit.framework.Test" property="junit.present"/>
2fc3991
  </target>
2fc3991
  <target name="junit-present" depends="test-junit-present" unless="junit.present">
2fc3991
    <echo>================================= WARNING ================================</echo>
2fc3991
    <echo> Junit isn't present in your $ANT_HOME/lib directory. Tests not executed. </echo>
2fc3991
    <echo>==========================================================================</echo>
2fc3991
  </target>
2fc3991
  <target name="test-offline">
2fc3991
    <condition property="maven.mode.offline">
2fc3991
      <equals arg1="${build.sysclasspath}" arg2="only"/>
2fc3991
    </condition>
2fc3991
  </target>
2fc3991
  <target name="get-deps" depends="test-offline" description="Download all dependencies" unless="maven.mode.offline">
2fc3991
    <mkdir dir="${maven.repo.local}"/>
2fc3991
    <mkdir dir="/home/deepak/DIST/maven-doxia/maven-doxia/org/codehaus/plexus/plexus-utils/1.0.4"/>
2fc3991
    <get src="http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.jar" dest="${maven.repo.local}/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.jar" usetimestamp="true" ignoreerrors="true"/>
2fc3991
    <mkdir dir="/home/deepak/DIST/maven-doxia/maven-doxia/oro/oro/2.0.7"/>
2fc3991
    <get src="http://repo1.maven.org/maven2/oro/oro/2.0.7/oro-2.0.7.jar" dest="${maven.repo.local}/oro/oro/2.0.7/oro-2.0.7.jar" usetimestamp="true" ignoreerrors="true"/>
2fc3991
    <mkdir dir="/home/deepak/DIST/maven-doxia/maven-doxia/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-7"/>
2fc3991
    <get src="http://repo1.maven.org/maven2/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-7/doxia-sink-api-1.0-alpha-7.jar" dest="${maven.repo.local}/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-7/doxia-sink-api-1.0-alpha-7.jar" usetimestamp="true" ignoreerrors="true"/>
2fc3991
  </target>
2fc3991
</project>