ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 44915] manifestclasspath interferes with other build targets when the classpath directory does not exist
Date Thu, 01 May 2008 15:14:27 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=44915





--- Comment #2 from David <david.green@morganstanley.com>  2008-05-01 08:14:26 PST ---
<project name="SomeApplication" default="all">

    <!-- PROJECT BASE / MAIN CLASS -->
    <property name="basedir" value="." />
    <property name="main.class" value="com.anyapps.start.${ant.project.name}"
/>

    <!-- BUILD DIRECTORIES -->
    <property name="source.dir" value="${basedir}/src" />
    <property name="build.dir" value="${basedir}/build" />
    <property name="classes.dir" value="${build.dir}/classes" />
    <property name="jar.dir" value="${build.dir}/jar" />
    <property name="jar.lib.dir" value="${jar.dir}/lib" />

    <!-- DIST DIRECTORIES (see install target) -->
    <property name="dist.dir" value="${basedir}/dist" />
    <property name="lib.dir" value="${dist.dir}/lib" />

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

    <target name="copylib" depends="clean">
        <delete dir="${dist.dir}" />
        <mkdir dir="${dist.dir}" />
        <mkdir dir="${jar.dir}" />
        <mkdir dir="${jar.lib.dir}" />
        <copy todir="${jar.lib.dir}" overwrite="true"> <!-- Copy
Spring/Hibernate/JDBC libraries etc. -->
            <fileset dir="${basedir}/lib" />
        </copy>
        <mkdir dir="${lib.dir}" />
        <copy todir="${lib.dir}" overwrite="true">
            <fileset dir="${basedir}/lib" />
        </copy>
    </target>

        <path id="build.classpath">
                <fileset dir="${jar.lib.dir}" includes="*.jar" />
        </path>

    <target name="compile">
        <javac srcdir="${source.dir}" destdir="${classes.dir}"
classpathref="build.classpath" />
    </target>

    <manifestclasspath property="jar.classpath"
jarfile="${jar.dir}/classpathjar.jar">
        <classpath refid="build.classpath" />
    </manifestclasspath>

    <target name="jar" depends="compile">
        <copy todir="${classes.dir}"> <!-- Copy Hibernate, log4J config files
etc. -->
            <fileset dir="${source.dir}" exclude="**/*.java" />
        </copy>
        <jar destfile="${jar.dir}/${ant.project.name}.jar"
basedir="${classes.dir}" index="no">
            <manifest>
                <attribute name="Main-Class" value="${main.class}" />
                <attribute name="Created-By" value="DG" />
                <attribute name="Class-Path" value="${jar-classpath}" />
            </manifest>
        </jar>
    </target>

    <target name="install">
        <copy file="${jar.dir}/${ant.project.name}.jar" todir="${dist.dir}" />
    </target>

    <target name="all" depends="copylib, jar, install" />

</project>


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Mime
View raw message