Ralph Vince - 2007-09-26

I've looked over the docs for JUnitDoclet, and I think if I were starting a project over I could implement this without a hitch. However -- I'm in an alpha stage on a project which I really cannot mess with my directory structure, or where my built jar files go to -- can anyone here show me, based on my enclosed Ant file, what I can amend therein so that I can create the test classes without screwing up my current build process and without altering my directory structure? It seems this should be easy but I am not facile with Ant and am afraid of blowing up this project already in an alpha stage. Thanks. R.Vince, buils.xml enclosed herein:

<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="all" name="Converter">
    <property file="build.ant.properties"/>
    <property name="converter-jar-target-dir" value="../../MSI/Framework/Template_Source/Deliverables/Converter"/>
    <!-- Written to assume that classpath is rooted in the current directory. -->
    <!-- So this should be OK if you make this script in the root of a filesystem. -->
    <!-- If not, just change src.dir to be the root of your sources' package tree -->
    <!-- and use e.g. View over a Filesystem to mount that subdirectory with all capabilities. -->
    <!-- The idea is that both Ant and NetBeans have to know what the package root is -->
    <!-- for the classes in your application. -->

    <!-- Don't worry if you don't know the Ant syntax completely or need help on some tasks! -->
    <!-- The standard Ant documentation can be downloaded from AutoUpdate and -->
    <!-- and then you can access the Ant manual in the online help. -->

    <target name="init">
        <property location="ConverterOutput" name="classes.dir"/>
        <property location="src" name="src.dir"/>
        <property location="doc" name="javadoc.dir"/>
        <property name="project.name" value="${ant.project.name}"/>
        <property location="${project.name}.jar" name="jar"/>
    </target>

    <target depends="init" name="compile">
        <!-- Both srcdir and destdir should be package roots. -->
        <mkdir dir="${classes.dir}"/>
        <javac
            classpath="../../MSI\Framework\Template_Source\Deliverables\Configurator\Configurator.jar;../../Common\lib\jdom.jar"
            debug="true"
            deprecation="true"
            destdir="${classes.dir}"
            srcdir="${src.dir}"
            target="1.4"
            source="1.4"
            >
            <!-- To add something to the classpath: -->
            <classpath><pathelement location="/resources/"/></classpath>
            <classpath><pathelement location="./jdom/"/></classpath>
            <!-- To exclude some files: -->
            <exclude name=".classpath"/>
            <exclude name=".project"/>
        </javac>
    </target>

    <target depends="init,compile" name="jar">
        <!-- To make a standalone app, insert into <jar>: -->       
        <jar basedir="${classes.dir}" compress="true" jarfile="${jar}" >           
            <zipfileset src="../../Common/lib/jdom.jar" includes="**/*.class" />
            <manifest>
                  <attribute name="Built-By" value="${user.name}"/>
                  <attribute name="Specification-Title" value="Converter"/>
                  <attribute name="Implementation-Title" value="Converter"/>                 
                  <attribute name="Main-Class" value="com.snapon.globalinstaller.configurator.Converter"/>
               </manifest>
        </jar>
        <copy file="${jar}" todir="${converter-jar-target-dir}" />
    </target>

    <target depends="init,jar" description="Build everything." name="all"/>

    <target depends="init" description="Javadoc for my API." name="javadoc">
        <mkdir dir="${javadoc.dir}"/>
        <javadoc destdir="${javadoc.dir}" packagenames="*">
            <sourcepath>
                <pathelement location="${src.dir}"/>
            </sourcepath>
        </javadoc>
    </target>

    <target depends="init" description="Clean all build products." name="clean">
        <delete dir="${classes.dir}"/>
        <delete dir="${javadoc.dir}"/>
        <delete file="${jar}"/>
    </target>

    <dirset id="changeme"/>
</project>