ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Weintraub <qazw...@gmail.com>
Subject Re: outofdate task returns TRUE if no target files exist??
Date Wed, 21 Jul 2010 00:55:47 GMT
I'm a little confused. The "outofdate" task returns a TRUE if the
files are "Out of Date". That is, you should do a build.

Do you mean that this task returns a FALSE instead? This task should
run the <sequential> tasks if your target files don't exist.

I recommend that you use the standard <uptodate> task against your
built EAR file. The Ant Contrib tasks (although popular) are no longer
being maintained as far as I know. There are about a half dozen errors
in the various tasks, and no one seems to be the one responsible for
maintaining the project.

The <uptodate> task can work with multiple source files, but only a
single target file.  (I know  you can somehow use a Mapper to map to
multiple targets, but I've never gotten it to work). The <uptodate>
task also only sets a property and doesn't allow you to specify a
bunch of tasks that you can run.

Typical setup is:

<task name="test-task">
    <uptodate property="task-needs-building">
        <blah, blah, blah...>
    </uptodate>
</task>

<task name="main-task"
    if="task-needs-building"
    requires="test-task">
    <blah, blah, blah...>
</task>

On Tue, Jul 20, 2010 at 3:35 PM, Marina <ppine7@yahoo.com> wrote:
> Hi, I wanted to see if the behavior I see when using the ant-contrib's
> 'outofdate' task is a correct one. Basically, I'm trying to determine if
> generated EAR archive (in the exploded form) has any out of date files in
> respect to the source directories, and re-copy those files if so.
> Here is my task:
>      <target name="check.ear.exploded.uptodate" >
>        <outofdate property="ear.not.uptodate">
>              <sourcefiles>
>                  <fileset dir="${build.jars}"
>                    includes="*.jar"/>
>                  <fileset dir="${build.wars}"
>                    includes="*.war"/>
>                  <fileset dir="${basedir}/rsrc/deployment"
>                    includes="application.xml"/>
>              </sourcefiles>
>              <targetfiles>
>                <fileset dir="${destination}/myapp.ear" includes="**/*"/>
>              </targetfiles>
>              <sequential>
>                <echo message="exploded myapp.ear dir is not uptodate -
> rebuilding"/>
>            </sequential>
>        </outofdate>
>      </target>
>
> Now, if there are no files in the "${destination}/myapp.ear" directory yet (I'm
> building for the first time after cleanup) - the outofdate task still returns
> TRUE. Needless to say, I would prefer the opposite behavior - if no target files
> exist - consider them out-of-date.
> Is this the expected behavior or am I missing something?
> Also, I hope this is the right forum to post this question to; if not - please
> let me know.
>
> Thanks!
> Marina



-- 
David Weintraub
qazwart@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message