ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Macey, Ian" <ian.ma...@cazenove.com>
Subject RE: Make Dependencies
Date Fri, 06 Apr 2001 16:27:05 GMT

> -----Original Message-----
> From: Conor MacNeill [mailto:conor@cortexebusiness.com.au]
> If you want to create a dependency between A.class and 
> b.class which is not
> reflected in the source, the you are right, and <depend> will 
> not help you.
> I guess you can use uptodate as Diane suggested. 

I've managed to solve my problem using Diane's suggestion.
Here's my initial solution using uptodate:

<project name="Servlets" default="compile" basedir=".">

    <property name="build.dir"  value="classes" />

    <path id="project.class.path"> . . . </path>

    <target name="compile" depends="staticFinalTouch">
        <mkdir dir="${build.dir}"/>
        <javac srcdir="." destdir="${build.dir}" includes="*.java"
excludes="Common.java"> 
            <classpath refid="project.class.path"/>
        </javac>
        <copy
todir="/prg/jboss_jetty/Jetty-3.0.2/webapps/corma/WEB-INF/classes" >
           <fileset dir="${build.dir}" includes="*.class" />
        </copy>
    </target>

    <target name="staticFinalTouch" depends="staticFinalCheck"
if="staticFinalTouch.required">
        <touch file="OrderSummary.java"/>
        <touch file="OrderDetail.java"/>
    </target>

    <target name="staticFinalCheck">
        <javac srcdir="." destdir="${build.dir}" includes="Common.java"> 
            <classpath refid="project.class.path"/>
        </javac>
        <uptodate property="staticFinalTouch.required"
targetfile="classes/Common.class" >
            <srcfiles dir="." includes="*.java" excludes="Common.java" />
        </uptodate>
    </target>

</project>

> think it would be rare where you want to set up a compile 
> dependency where
> there is no source relationship between the classes.

As you can probably tell from the build.xml, my problem is with a file
being used to hold a series of static finals which are used in a number
of servlets.

Unfortunately such static finals slip past past depends' relying "upon the
class references encoded into the class files by the compiler" for well
known java-gotcha reasons...

Thanks for the help - if anyone knows of a better way to do this in Ant
let me know, otherwise I think this a workable solution.


Ian


___________________________________________________
CAZENOVE & CO.

DISCLAIMER, PLEASE NOTE:

This communication is for the attention of the
named recipient only and should not be passed
on to any other person. Information relating to
any company or security, is for information
purposes only and should not be interpreted as
a solicitation or offer to buy or sell any security.
The information on which this communication is based
has been obtained from sources we believe to be reliable,
but we do not guarantee its accuracy or completeness.
All expressions of opinion are subject to change
without notice.
___________________________________________________

Mime
View raw message