You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Scot P. Floess" <fl...@mindspring.com> on 2006/05/12 15:39:46 UTC
Outputting file sets that do not exist...
Help...this is driving me nuts ;)
Let's say I want to define a path - but for "whatever" reason parts of
the path do not exist as specified in a fileset or dirset. Below is an
example (please note - I have no /foo directory on my harddrive):
<project name = "dir-test" default = "output">
<taskdef resource = "net/sf/antcontrib/antlib.xml"/>
<path id = "PATH_REF_ID">
<fileset dir = "/foo">
<include name = "**/**.jar"/>
</fileset>
</path>
<pathconvert property = "PATH" refid = "PATH_REF_ID"/>
<target name = "output">
<!--
-
- Loop through all javacc files to compile...
-
-->
<for param = "path-part">
<path refid = "PATH_REF_ID"/>
<sequential>
<echo message = "@{path-part}"/>
</sequential>
</for>
</target>
</project>
Above, I actually tried two things - using a <pathconvert> as well as
trying to iterate over the path using <for>. Regardless, I get flagged
from ant stating /foo does not exist - which it doesn't ;) Really, what
I am trying to figure out is, in a much larger sense, if I have filesets
where some portions do exist and others do not, how can I output what is
there. One way was to wrap in a <try> <catch> but I didn't really like
that solution...as the failure arose and all I could do was output a
message stating "some parts do not exist"
It's not any better setting a property and using refid of the path
either - doesn't work - same error :|
Anyone have a good suggestion to the above? It's a long story as to why
I want to output in this way...but I have a reason for wanting to do so :)
Thanks ahead of time!
Scot
--
Scot P. Floess
27 Lake Royale
Louisburg, NC 27549
252-478-8087 (Home)
919-754-4592 (Work)
Chief Architect JPlate http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Outputting file sets that do not exist...
Posted by "Scot P. Floess" <fl...@mindspring.com>.
Uhm and please disregard the comment pertaining to javacc ;) I cut 'n
pasted into a new build.xml to hack away on the part I needed :) I just
noticed I left the comment in place ;)
Scot P. Floess wrote:
> Help...this is driving me nuts ;)
>
> Let's say I want to define a path - but for "whatever" reason parts of
> the path do not exist as specified in a fileset or dirset. Below is
> an example (please note - I have no /foo directory on my harddrive):
>
> <project name = "dir-test" default = "output">
> <taskdef resource = "net/sf/antcontrib/antlib.xml"/>
>
> <path id = "PATH_REF_ID">
> <fileset dir = "/foo">
> <include name = "**/**.jar"/>
> </fileset>
> </path>
>
> <pathconvert property = "PATH" refid = "PATH_REF_ID"/>
>
> <target name = "output">
> <!--
> -
> - Loop through all javacc files to compile...
> -
> -->
> <for param = "path-part">
> <path refid = "PATH_REF_ID"/>
>
> <sequential>
> <echo message = "@{path-part}"/>
> </sequential>
> </for>
> </target>
> </project>
>
> Above, I actually tried two things - using a <pathconvert> as well as
> trying to iterate over the path using <for>. Regardless, I get
> flagged from ant stating /foo does not exist - which it doesn't ;)
> Really, what I am trying to figure out is, in a much larger sense, if
> I have filesets where some portions do exist and others do not, how
> can I output what is there. One way was to wrap in a <try> <catch>
> but I didn't really like that solution...as the failure arose and all
> I could do was output a message stating "some parts do not exist"
>
> It's not any better setting a property and using refid of the path
> either - doesn't work - same error :|
>
> Anyone have a good suggestion to the above? It's a long story as to
> why I want to output in this way...but I have a reason for wanting to
> do so :)
>
> Thanks ahead of time!
>
> Scot
>
--
Scot P. Floess
27 Lake Royale
Louisburg, NC 27549
252-478-8087 (Home)
919-754-4592 (Work)
Chief Architect JPlate http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Outputting file sets that do not exist...
Posted by Matt Benson <gu...@yahoo.com>.
Scot:
A "fileset that does not exist" is a contradiction
in terms. A fileset, by definition, consists of
existing files accessible from an existing directory.
Nonexistence of the parent directory yields a build
error, as you have seen. If no child files can be
matched by the fileset's (explicit or implicit)
patterns the fileset will be empty (additional
narrowing is accomplished by any nested selectors).
You can, however, use filelists, paths, and
pathelements to compose paths some of whose members do
not exist.
HTH,
Matt
--- "Scot P. Floess" <fl...@mindspring.com> wrote:
> Help...this is driving me nuts ;)
>
> Let's say I want to define a path - but for
> "whatever" reason parts of
> the path do not exist as specified in a fileset or
> dirset. Below is an
> example (please note - I have no /foo directory on
> my harddrive):
>
> <project name = "dir-test" default = "output">
> <taskdef resource =
> "net/sf/antcontrib/antlib.xml"/>
>
> <path id = "PATH_REF_ID">
> <fileset dir = "/foo">
> <include name = "**/**.jar"/>
> </fileset>
> </path>
>
> <pathconvert property = "PATH" refid =
> "PATH_REF_ID"/>
>
> <target name = "output">
> <!--
> -
> - Loop through all javacc files to
> compile...
> -
> -->
> <for param = "path-part">
> <path refid = "PATH_REF_ID"/>
>
> <sequential>
> <echo message = "@{path-part}"/>
> </sequential>
> </for>
> </target>
> </project>
>
> Above, I actually tried two things - using a
> <pathconvert> as well as
> trying to iterate over the path using <for>.
> Regardless, I get flagged
> from ant stating /foo does not exist - which it
> doesn't ;) Really, what
> I am trying to figure out is, in a much larger
> sense, if I have filesets
> where some portions do exist and others do not, how
> can I output what is
> there. One way was to wrap in a <try> <catch> but I
> didn't really like
> that solution...as the failure arose and all I could
> do was output a
> message stating "some parts do not exist"
>
> It's not any better setting a property and using
> refid of the path
> either - doesn't work - same error :|
>
> Anyone have a good suggestion to the above? It's a
> long story as to why
> I want to output in this way...but I have a reason
> for wanting to do so :)
>
> Thanks ahead of time!
>
> Scot
>
> --
> Scot P. Floess
> 27 Lake Royale
> Louisburg, NC 27549
>
> 252-478-8087 (Home)
> 919-754-4592 (Work)
>
> Chief Architect JPlate
> http://sourceforge.net/projects/jplate
> Chief Architect JavaPIM
> http://sourceforge.net/projects/javapim
>
>
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org