You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Marina <pp...@yahoo.com> on 2010/07/20 21:35:00 UTC
outofdate task returns TRUE if no target files exist??
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
Re: outofdate task returns TRUE if no target files exist??
Posted by Peter Reilly <pe...@gmail.com>.
You do not need to leave any files in the myapp.ear directory.
You just need to define a file should be present when the
ear is built.
Peter
On Wed, Jul 21, 2010 at 1:52 PM, Marina <pp...@yahoo.com> wrote:
> David, Peter,
>
> thanks for your responses.
>
> Peter - thanks for the suggestion - I'll try it out.Although in my situation, I
> really do not have any files in the myapp.ear directory, as I remove all content
> before re-building the EAR. I guess I could intentionally leave something
> behind...
>
> David, sorry - you are absolutely right, I've mistyped the result :)
> It is indeed returns FALSE (though I would expect TRUE), and as a result the
> task in the <sequential> is not being run.
>
> I've looked at the 'uptodate', and my issue with using it is that it does not
> support multiple target files. If I had an archived EAR (just one myapp.ear
> file) - it would work fine, but since I'm deploying in the exploded format, I
> have the myapp.ear/ directory wit all content exploded as well...
>
> I was looking at the <mapper> task - but I'm not sure how I could map, say, a
> JAR file name to a directory name and all content under it. What I mean is that
> I have a myEjb1.jar (which is one archive file, with the ejb content), and then
> I have a myapp.ear/myEjb1.jar/ directory with the corresponding content .
>
> I see your point about the ant-contrib being unmaintained right now though - so
> I'll try to stay away from it and use core Ant tasks instead.
>
> thanks for your response,
> Marina
>
>
>
>
>
> ________________________________
> From: Peter Reilly <pe...@gmail.com>
> To: Ant Users List <us...@ant.apache.org>
> Sent: Wed, July 21, 2010 5:16:42 AM
> Subject: Re: outofdate task returns TRUE if no target files exist??
>
> The problem is that you are specifying no targetfiles.
>
> In this case, I normally pick a scapegoat file that I know should
> always be present. - ${destination}/myapp.ear/WEB-INF/web.xml
> or some such file.
>
> <targetfiles>
> <fileset dir="${destination}/myapp.ear" includes="**/*"/>
> <path path="${destination}/myapp.ear/WEB-INF/web.xml"/>
> </targetfiles>
>
>
> I suppose that one could change <outofdate> to always trigger if
> there are no <targetfiles> as that is a common use case.
>
> Peter
>
>
> On Tue, Jul 20, 2010 at 8:35 PM, Marina <pp...@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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: outofdate task returns TRUE if no target files exist??
Posted by Marina <pp...@yahoo.com>.
David, Peter,
thanks for your responses.
Peter - thanks for the suggestion - I'll try it out.Although in my situation, I
really do not have any files in the myapp.ear directory, as I remove all content
before re-building the EAR. I guess I could intentionally leave something
behind...
David, sorry - you are absolutely right, I've mistyped the result :)
It is indeed returns FALSE (though I would expect TRUE), and as a result the
task in the <sequential> is not being run.
I've looked at the 'uptodate', and my issue with using it is that it does not
support multiple target files. If I had an archived EAR (just one myapp.ear
file) - it would work fine, but since I'm deploying in the exploded format, I
have the myapp.ear/ directory wit all content exploded as well...
I was looking at the <mapper> task - but I'm not sure how I could map, say, a
JAR file name to a directory name and all content under it. What I mean is that
I have a myEjb1.jar (which is one archive file, with the ejb content), and then
I have a myapp.ear/myEjb1.jar/ directory with the corresponding content .
I see your point about the ant-contrib being unmaintained right now though - so
I'll try to stay away from it and use core Ant tasks instead.
thanks for your response,
Marina
________________________________
From: Peter Reilly <pe...@gmail.com>
To: Ant Users List <us...@ant.apache.org>
Sent: Wed, July 21, 2010 5:16:42 AM
Subject: Re: outofdate task returns TRUE if no target files exist??
The problem is that you are specifying no targetfiles.
In this case, I normally pick a scapegoat file that I know should
always be present. - ${destination}/myapp.ear/WEB-INF/web.xml
or some such file.
<targetfiles>
<fileset dir="${destination}/myapp.ear" includes="**/*"/>
<path path="${destination}/myapp.ear/WEB-INF/web.xml"/>
</targetfiles>
I suppose that one could change <outofdate> to always trigger if
there are no <targetfiles> as that is a common use case.
Peter
On Tue, Jul 20, 2010 at 8:35 PM, Marina <pp...@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
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: outofdate task returns TRUE if no target files exist??
Posted by Peter Reilly <pe...@gmail.com>.
The problem is that you are specifying no targetfiles.
In this case, I normally pick a scapegoat file that I know should
always be present. - ${destination}/myapp.ear/WEB-INF/web.xml
or some such file.
<targetfiles>
<fileset dir="${destination}/myapp.ear" includes="**/*"/>
<path path="${destination}/myapp.ear/WEB-INF/web.xml"/>
</targetfiles>
I suppose that one could change <outofdate> to always trigger if
there are no <targetfiles> as that is a common use case.
Peter
On Tue, Jul 20, 2010 at 8:35 PM, Marina <pp...@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
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: outofdate task returns TRUE if no target files exist??
Posted by David Weintraub <qa...@gmail.com>.
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 <pp...@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
Re: outofdate task returns TRUE if no target files exist??
Posted by glenn opdycke-hansen <gl...@gmail.com>.
If you want a specific behavior from a script, what if you specifically code
that behavior? Then you do not have to depend on antcontrib.
I would test to see if a the directory is empty then set the property or
call the target that you are expecting in the script.
--glenn
On Tue, Jul 20, 2010 at 14:35, Marina <pp...@yahoo.com> wrote:
> 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.
>