File jdependency-build.xml of Package jdependency

<?xml version="1.0" encoding="UTF-8"?>

<project name="jdependency" default="package" basedir=".">

  <!-- ====================================================================== -->
  <!-- Build environment properties                                           -->
  <!-- ====================================================================== -->

  <property file="build.properties"/>
  <property name="project.artifactId" value="jdependency"/>
  <property name="project.groupId" value="org.vafer"/>
  <property name="project.version" value="1.4"/>
  <property name="compiler.source" value="1.8"/>
  <property name="compiler.target" value="${compiler.source}"/>
  <property name="build.finalName" value="${project.artifactId}-${project.version}"/>
  <property name="build.dir" value="target"/>
  <property name="build.outputDir" value="${build.dir}/classes"/>
  <property name="build.srcDir" value="src/main/java"/>
  <property name="build.resourceDir" value="src/main/resources"/>
  <property name="build.testOutputDir" value="${build.dir}/test-classes"/>
  <property name="build.testWorkingDir" value="${build.dir}/test-working-directory"/>
  <property name="build.testDir" value="src/test/java"/>
  <property name="build.testResourceDir" value="src/test/resources"/>
  <property name="test.reports" value="${build.dir}/test-reports"/>
  <property name="reporting.outputDirectory" value="${build.dir}/site"/>

  <!-- ====================================================================== -->
  <!-- Defining classpaths                                                    -->
  <!-- ====================================================================== -->

  <path id="build.classpath">
    <fileset dir="lib">
      <!-- commons-io-2.5
	       asm-6.0_BETA -->
      <include name="**/*.jar"/>
    </fileset>
  </path>

  <path id="build.test.classpath">
    <fileset dir="lib">
      <!-- commons-io-2.5
	       asm-6.0_BETA asm-analysis-6.0_BETA asm-commons-6.0_BETA
		   asm-util-6.0_BETA asm-tree-6.0_BETA
           junit-4.12 hamcrest-core-1.3 -->
      <include name="**/*.jar"/>
    </fileset>
  </path>

  <!-- ====================================================================== -->
  <!-- Cleaning up target                                                     -->
  <!-- ====================================================================== -->

  <target name="clean" description="Clean the output directory">
    <delete dir="${build.dir}"/>
  </target>

  <!-- ====================================================================== -->
  <!-- Compilation target                                                     -->
  <!-- ====================================================================== -->

  <target name="compile" description="Compile the code">
    <mkdir dir="${build.outputDir}"/>
    <javac destdir="${build.outputDir}" encoding="UTF-8" nowarn="false" debug="true" optimize="false" deprecation="true" target="${compiler.target}" verbose="false" fork="false" source="${compiler.source}">
      <src>
        <pathelement location="${build.srcDir}"/>
      </src>
      <classpath refid="build.classpath"/>
    </javac>
  </target>

  <!-- ====================================================================== -->
  <!-- Test-compilation target                                                -->
  <!-- ====================================================================== -->

  <target name="compile-tests" depends="compile" description="Compile the test code" unless="test.skip">
    <mkdir dir="${build.testOutputDir}"/>
    <javac destdir="${build.testOutputDir}" encoding="UTF-8" nowarn="false" debug="true" optimize="false" deprecation="true" target="${compiler.target}" verbose="false" fork="false" source="${compiler.source}">
      <src>
        <pathelement location="${build.testDir}"/>
      </src>
      <classpath>
        <path refid="build.test.classpath"/>
        <pathelement location="${build.outputDir}"/>
      </classpath>
    </javac>
    <copy todir="${build.testOutputDir}">
      <fileset dir="${build.testResourceDir}"/>
    </copy>
  </target>

  <!-- ====================================================================== -->
  <!-- Run all tests                                                          -->
  <!-- ====================================================================== -->

  <target name="test" depends="compile-tests, junit-missing" unless="junit.skipped" description="Run the test cases">
    <mkdir dir="${build.testWorkingDir}"/>
    <copy todir="${build.testWorkingDir}">
      <fileset includes="*.jar" dir="${build.testResourceDir}"/>
    </copy>
    <unjar src="${build.testWorkingDir}/jar1.jar" dest="${build.testWorkingDir}/jar1"/>
    <unjar src="${build.testWorkingDir}/jar2.jar" dest="${build.testWorkingDir}/jar2"/>
    <unjar src="${build.testWorkingDir}/jar1-missing.jar" dest="${build.testWorkingDir}/jar1-missing"/>
    <unjar src="${build.testWorkingDir}/jar3using1.jar" dest="${build.testWorkingDir}/jar3using1"/>
    <mkdir dir="${test.reports}"/>
    <junit printSummary="yes" haltonerror="true" haltonfailure="true" fork="true" dir="${build.testWorkingDir}">
      <formatter type="xml"/>
      <formatter type="plain" usefile="false"/>
      <classpath>
        <path refid="build.test.classpath"/>
        <pathelement location="${build.outputDir}"/>
        <pathelement location="${build.testOutputDir}"/>
      </classpath>
      <batchtest todir="${test.reports}" unless="test">
        <fileset dir="${build.testDir}">
          <include name="**/*TestCase.java"/>
          <exclude name="**/Abstract*"/>
        </fileset>
      </batchtest>
      <batchtest todir="${test.reports}" if="test">
        <fileset dir="${build.testDir}">
          <include name="**/${test}.java"/>
          <exclude name="**/Abstract*"/>
        </fileset>
      </batchtest>
    </junit>
  </target>

  <target name="test-junit-present">
    <available classname="junit.framework.Test" property="junit.present" classpathref="build.test.classpath"/>
  </target>

  <target name="test-junit-status" depends="test-junit-present">
    <condition property="junit.missing">
      <and>
        <isfalse value="${junit.present}"/>
        <isfalse value="${test.skip}"/>
      </and>
    </condition>
    <condition property="junit.skipped">
      <or>
        <isfalse value="${junit.present}"/>
        <istrue value="${test.skip}"/>
      </or>
    </condition>
  </target>

  <target name="junit-missing" depends="test-junit-status" if="junit.missing">
    <echo>=================================== WARNING ===================================</echo>
    <echo> JUnit is not present in the test classpath or your $ANT_HOME/lib directory. Tests not executed.</echo>
    <echo>===============================================================================</echo>
  </target>

  <!-- ====================================================================== -->
  <!-- Javadoc target                                                         -->
  <!-- ====================================================================== -->

  <target name="javadoc" description="Generates the Javadoc of the application">
    <javadoc sourcepath="${build.srcDir}" packagenames="*" destdir="${reporting.outputDirectory}/apidocs" access="protected" source="${compiler.source}" classpathref="build.classpath" verbose="false" version="true" use="true" author="true" splitindex="false" nodeprecated="false" nodeprecatedlist="false" notree="false" noindex="false" nohelp="false" nonavbar="false" serialwarn="false" charset="ISO-8859-1" linksource="true" breakiterator="false">
    </javadoc>
  </target>

  <!-- ====================================================================== -->
  <!-- Package target                                                         -->
  <!-- ====================================================================== -->

  <target name="package" depends="compile,test" description="Package the application">
    <jar jarfile="${build.dir}/${build.finalName}.jar" compress="true" index="false" basedir="${build.outputDir}" excludes="**/package.html">
      <manifest>
        <attribute name="JavaPackages-ArtifactId" value="${project.artifactId}"/>
        <attribute name="JavaPackages-GroupId" value="${project.groupId}"/>
        <attribute name="JavaPackages-Version" value="${project.version}"/>
      </manifest>
    </jar>
  </target>

  <!-- ====================================================================== -->
  <!-- A dummy target for the package named after the type it creates         -->
  <!-- ====================================================================== -->

  <target name="jar" depends="package" description="Builds the jar for the application"/>

</project>
openSUSE Build Service is sponsored by