Set debug and optimize for javac : Compile « Ant « Java






Set debug and optimize for javac

 
<?xml version="1.0"?>

<project name="yourName" default="junitgui" basedir=".">
  <property name="junitJar" value="\junit3.8.1\junit.jar" />
  <property name="src.dir" value="${basedir}\src" />
  <property name="build.dir" value="${basedir}\classes" />

  <path id="classpath">
    <pathelement location="${junitJar}" />
    <pathelement location="${build.dir}" />
  </path>

  <target name="init">
    <mkdir dir="${build.dir}" />
  </target>

  <target name="build" depends="init" description="build all">
    <javac
        srcdir="${src.dir}" destdir="${build.dir}"
        source="1.5" 
        deprecation="on" debug="on" optimize="off" includes="**">
      <classpath refid="classpath" />
    </javac>
  </target>

  <target name="junitgui" depends="build" description="run junitgui">
    <java classname="junit.awtui.TestRunner" fork="yes">
      <arg value="sis.AllTests" />
      <classpath refid="classpath" />
    </java>
  </target>

   <target name="clean">  
    <delete dir="${build.dir}" />
  </target>

   <target name="rebuildAll" depends="clean,build" description="rebuild all"/>
</project>

   
  








Related examples in the same category

1.Compile the web application
2.Ant target:compile
3.Compile the stand-alone application
4.Use a precompiler with Java
5.Indicate the init and max memory when compiling
6.Ant Javac setting
7.Ant javac includes
8.Javac include and exclude
9.Javac with classpath
10.Javac with encoding
11.Javac with optimize
12.Set failonerror for javac
13.Set debuglevel for javac
14.Set link for Javac
15.Set source version in javac
16.Set target for javac
17.Ant compile from src folder to build folder, set the class path and java files include