ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Proper use of <uptodate>
Date Tue, 18 Dec 2001 21:02:55 GMT
That did the trick - thanks much!

I think I learned something from this regarding task execution within a <target> definition.
Perhaps it exists, but is there anyplace in the docs that explains what happens when a <target>
is "executed", how Ant decides it should execute a task (relationship to the filesets that
are built up), etc.? I think certain aspects of this are starting to click, but I want to
make sure I'm not misapprehending anything.

Also, is it possible to use <echo> within any task? For example:

<javac ...>
  <echo message="Running javac ..." />

 If not, I'd find that useful.

Finally, I just want to say thanks. Ant has been astoundingly helpful this last week in getting
our fairly large web/ejb-based app to build targeting WebLogic. While I'm not using the <ejbc>
task directly (too complex - just using <java>), I've discovered the <ear> and
<war> tasks and some of the special capabilities provided by <zipfileset>. These
are terrific. Our app builds identically now from a single rules.xml file on either NT or
AIX. Very much appreciated !!!


>>> 12/18/01 02:15PM >>>
If I've got your requirements straight, try:

  <target name="jars" depends="jar1" if="build.jar2">
    <java for your jar2.jar.../>

  <target name="jar1">
    <jar for your jar1.jar .../>
    <uptodate property="build.jar2" targetfile="jar1.jar">
      <srcfiles dir="." includes="jar2.jar"/>


--- Donnie Hale <> wrote:
> I've checked the docs and faq on this and am still a little unsure of
> how
> <uptodate> is intended to be used.
> Here's my situation:
> src/**/*.java
>     classes/**/*.class
>         lib/jar1.jar
>             lib/jar2.jar
> The indentations imply dependencies. I want to make sure that jar2 is
> built
> if jar1 had to have been built, either because it didn't exist or was
> out-of-date with respect to any of the .class files. Importantly, I
> don't
> want jar2 built it exists and if jar1 wasn't rebuilt, as that's a fairly
> expensive step.
> As I see it, there are 3 possible situations when the script begins:
> 1) jar1 exists but is out of date (jar1 and jar2 should be built)
> 2) jar 2 doesn't exist (jar1 and jar2 should be built)
> 3) jar1 exists and is up-to-date (jar 1 should not be built, jar 2
> should be
> built if it's out-of-date)
> So I've tried putting an <uptodate> in my prepare task, and that seems
> to
> make sure jar2 doesn't get built if jar1 is up-to-date. And I have an
> <uptodate> in my jar1 task. But, with "unless" on my jar2 task, that
> doesn't
> ensure that my jar2 task gets run if the jar1 task is run.
> My <uptodate> is of the form:
> <uptodate property="jar2.notrequired" target="${libdir}/jar2.jar">
>     <srcfiles dir="${libdir}" includes="jar1.jar" />
> </uptodate>
> The docs on <uptodate> give a completely out-of-context example, so
> that's
> why I'm stuck. Any advice would be helpful. Also, how do "if" and
> "unless"
> interpret (quoting the docs) "the property that must [not] be be set"?
> Does
> that mean set to anything? Or just not set to the value "false"? Lastly,
> is
> there a way to "unset" a property in a task?
> Thanks much,
> Donnie
> --
> To unsubscribe, e-mail:  
> <>
> For additional commands, e-mail:
> <>


Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at 
or bid at 

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message