You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Bob Noonan <no...@cs.wm.edu> on 2005/10/28 20:17:33 UTC
Need to expand *.txt in java task
Hi,
Please forgive my stupidity, but I have spent hours on this ...
Given the following Unix/Linux command line:
java Test.Main -all *.txt
I wrote the following ant task:
<java classname="Test.Main">
<arg value="-all" />
<arg value="*.java" />
</java>
Test.Main reports it cannot find file *.java.
So I replaced the 2nd arg with a <fileset ... />.
The ant java task reports that it does not accept <fileset>'s.
Similarly, I tried nesting a fileset within an arg. Illegal.
I checked the O'Reilly Ant book and ant.apache.org
without finidng a solution.
I am clearly missing something. It should not be this hard.
Thanks,
Bob
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Need to expand *.txt in java task
Posted by Dale Anson <da...@grafidog.com>.
I'd suggest you start here:
http://www.catb.org/~esr/faqs/smart-questions.html
That might help you get a better response.
Bob Noonan wrote:
> the task given in the rely generates a:
>
> pathconvert does not support nested fileset
>
> ditto the following example taken from ant.apache.org/manual/using.html:
>
> <path id="base.path">
> <pathelement path="${classpath}"/>
> <fileset dir="lib">
> <include name="**/*.jar"/>
> </fileset>
> <pathelement location="classes"/>
> </path>
>
> generates:
>
> corona> ant -f filelist.xml
> Buildfile: filelist.xml
>
> alt:
>
> BUILD FAILED
> /home/f85/noonan/301/proj3/noonan/filelist.xml:11: Class
> org.apache.tools.ant.types.Path$PathElement doesn't support the
> nested "fileset" element.
>
> Total time: 0 seconds
> corona> ant -f filelist.xml
> Buildfile: filelist.xml
>
> alt:
>
> BUILD FAILED
> /home/f85/noonan/301/proj3/noonan/filelist.xml:11: Class
> org.apache.tools.ant.types.Path$PathElement doesn't support the
> nested "fileset" element.
>
> Total time: 0 seconds
> corona>
>
>
> Like I said: it should NOT be this hard.
>
> Regards,
> Bob
>
>
>>
>> You could use PathConvert to convert your fileset into a string with
>> the list of files. You will probably want to set pathsep=" " and
>> use arg line="${fileslist}".
>>
>> So, you have:
>> <pathconvert pathsep=" " property="fileslist">
>> <fileset dir="${workingdir} includes="*.java"/>
>> </pathconvert>
>>
>>
>>
>> I haven't tried it, but it should work.
>>
>>>> Hi,
>>>>
>>>> Please forgive my stupidity, but I have spent hours on this ...
>>>>
>>>> Given the following Unix/Linux command line:
>>>>
>>>> java Test.Main -all *.txt
>>>>
>>>> I wrote the following ant task:
>>>>
>>>>
>>>>
>>>> Test.Main reports it cannot find file *.java.
>>>>
>>>> So I replaced the 2nd arg with a .
>>>> The ant java task reports that it does not accept 's.
>>>>
>>>> Similarly, I tried nesting a fileset within an arg. Illegal.
>>>>
>>>> I checked the O'Reilly Ant book and ant.apache.org
>>>> without finidng a solution.
>>>> I am clearly missing something. It should not be this hard.
>>>>
>>>> Thanks,
>>>> Bob
>>>>
>>>> -------------------------------------------------------------------- -
>>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>>> For additional commands, e-mail: user-help@ant.apache.org
>>>>
>>>>
>>>> --
>>>> No virus found in this incoming message.
>>>> Checked by AVG Free Edition.
>>>> Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date:
>>>> 27/10/2005
>>>>
>>>>
>>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> 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: *****spam***** Re: Need to expand *.txt in java task
Posted by Geoffrey Mitchell <ga...@imail.kwcorp.com>.
The following works under ant 1.6.5:
<pathconvert pathsep=" " property="foo">
<path>
<fileset dir="${basedir}" includes="*.foo"/>
</path>
</pathconvert>
I inadvertantly omitted the <path>...</path> in my initial example.
It should be mentioned that if you have spaces in the paths to your
working directory, <arg line="..."> will not work as expected, as it
will break arguments on the spaces, generating errors (pathconvert
returns the full path to each file). Also, be sure to note the
difference between <arg value="..."> and <arg line="...">
(http://ant.apache.org/manual/using.html#arg).
Bob Noonan wrote:
> the task given in the rely generates a:
>
> pathconvert does not support nested fileset
>
> ditto the following example taken from ant.apache.org/manual/using.html:
>
> <path id="base.path">
> <pathelement path="${classpath}"/>
> <fileset dir="lib">
> <include name="**/*.jar"/>
> </fileset>
> <pathelement location="classes"/>
> </path>
>
> generates:
>
> corona> ant -f filelist.xml
> Buildfile: filelist.xml
>
> alt:
>
> BUILD FAILED
> /home/f85/noonan/301/proj3/noonan/filelist.xml:11: Class
> org.apache.tools.ant.types.Path$PathElement doesn't support the
> nested "fileset" element.
>
> Total time: 0 seconds
> corona> ant -f filelist.xml
> Buildfile: filelist.xml
>
> alt:
>
> BUILD FAILED
> /home/f85/noonan/301/proj3/noonan/filelist.xml:11: Class
> org.apache.tools.ant.types.Path$PathElement doesn't support the
> nested "fileset" element.
>
> Total time: 0 seconds
> corona>
>
>
> Like I said: it should NOT be this hard.
>
> Regards,
> Bob
>
>
>>
>> You could use PathConvert to convert your fileset into a string with
>> the list of files. You will probably want to set pathsep=" " and
>> use arg line="${fileslist}".
>>
>> So, you have:
>> <pathconvert pathsep=" " property="fileslist">
>> <fileset dir="${workingdir} includes="*.java"/>
>> </pathconvert>
>>
>>
>>
>> I haven't tried it, but it should work.
>>
>>>> Hi,
>>>>
>>>> Please forgive my stupidity, but I have spent hours on this ...
>>>>
>>>> Given the following Unix/Linux command line:
>>>>
>>>> java Test.Main -all *.txt
>>>>
>>>> I wrote the following ant task:
>>>>
>>>>
>>>>
>>>> Test.Main reports it cannot find file *.java.
>>>>
>>>> So I replaced the 2nd arg with a .
>>>> The ant java task reports that it does not accept 's.
>>>>
>>>> Similarly, I tried nesting a fileset within an arg. Illegal.
>>>>
>>>> I checked the O'Reilly Ant book and ant.apache.org
>>>> without finidng a solution.
>>>> I am clearly missing something. It should not be this hard.
>>>>
>>>> Thanks,
>>>> Bob
>>>>
>>>> -------------------------------------------------------------------- -
>>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>>> For additional commands, e-mail: user-help@ant.apache.org
>>>>
>>>>
>>>> --
>>>> No virus found in this incoming message.
>>>> Checked by AVG Free Edition.
>>>> Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date:
>>>> 27/10/2005
>>>>
>>>>
>>>>
>>>
>>>
>> ---------------------------------------------------------------------
>> 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: Need to expand *.txt in java task
Posted by Bob Noonan <no...@cs.wm.edu>.
the task given in the rely generates a:
pathconvert does not support nested fileset
ditto the following example taken from ant.apache.org/manual/using.html:
<path id="base.path">
<pathelement path="${classpath}"/>
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
<pathelement location="classes"/>
</path>
generates:
corona> ant -f filelist.xml
Buildfile: filelist.xml
alt:
BUILD FAILED
/home/f85/noonan/301/proj3/noonan/filelist.xml:11: Class
org.apache.tools.ant.types.Path$PathElement doesn't support the
nested "fileset" element.
Total time: 0 seconds
corona> ant -f filelist.xml
Buildfile: filelist.xml
alt:
BUILD FAILED
/home/f85/noonan/301/proj3/noonan/filelist.xml:11: Class
org.apache.tools.ant.types.Path$PathElement doesn't support the
nested "fileset" element.
Total time: 0 seconds
corona>
Like I said: it should NOT be this hard.
Regards,
Bob
>
> You could use PathConvert to convert your fileset into a string
> with the list of files. You will probably want to set pathsep=" "
> and use arg line="${fileslist}".
>
> So, you have:
> <pathconvert pathsep=" " property="fileslist">
> <fileset dir="${workingdir} includes="*.java"/>
> </pathconvert>
>
>
>
> I haven't tried it, but it should work.
>
>>> Hi,
>>>
>>> Please forgive my stupidity, but I have spent hours on this ...
>>>
>>> Given the following Unix/Linux command line:
>>>
>>> java Test.Main -all *.txt
>>>
>>> I wrote the following ant task:
>>>
>>>
>>>
>>> Test.Main reports it cannot find file *.java.
>>>
>>> So I replaced the 2nd arg with a .
>>> The ant java task reports that it does not accept 's.
>>>
>>> Similarly, I tried nesting a fileset within an arg. Illegal.
>>>
>>> I checked the O'Reilly Ant book and ant.apache.org
>>> without finidng a solution.
>>> I am clearly missing something. It should not be this hard.
>>>
>>> Thanks,
>>> Bob
>>>
>>> --------------------------------------------------------------------
>>> -
>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>> For additional commands, e-mail: user-help@ant.apache.org
>>>
>>>
>>> --
>>> No virus found in this incoming message.
>>> Checked by AVG Free Edition.
>>> Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date:
>>> 27/10/2005
>>>
>>>
>>>
>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
Re: Need to expand *.txt in java task
Posted by Geoffrey Mitchell <ga...@imail.kwcorp.com>.
You could use PathConvert to convert your fileset into a string with the
list of files. You will probably want to set pathsep=" " and use arg
line="${fileslist}".
So, you have:
<pathconvert pathsep=" " property="fileslist">
<fileset dir="${workingdir} includes="*.java"/>
</pathconvert>
<java classname="Test.Main">
<arg value="-all" />
<arg line="${fileslist}" />
</java>
I haven't tried it, but it should work.
>>Hi,
>>
>>Please forgive my stupidity, but I have spent hours on this ...
>>
>>Given the following Unix/Linux command line:
>>
>> java Test.Main -all *.txt
>>
>>I wrote the following ant task:
>>
>> <java classname="Test.Main">
>> <arg value="-all" />
>> <arg value="*.java" />
>> </java>
>>
>>Test.Main reports it cannot find file *.java.
>>
>>So I replaced the 2nd arg with a <fileset ... />.
>>The ant java task reports that it does not accept <fileset>'s.
>>
>>Similarly, I tried nesting a fileset within an arg. Illegal.
>>
>>I checked the O'Reilly Ant book and ant.apache.org
>>without finidng a solution.
>>I am clearly missing something. It should not be this hard.
>>
>>Thanks,
>>Bob
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>>--
>>No virus found in this incoming message.
>>Checked by AVG Free Edition.
>>Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 27/10/2005
>>
>>
>>
>>
>
>
>
>
>
Re: Need to expand *.txt in java task
Posted by Rhino <rh...@sympatico.ca>.
I'm sure it's obvious to you but it sure isn't to me: what is it that you're
trying to do?
Also what Ant version are you using and how much experience do you have with
Ant? I'm inclined to guess that you're just getting started with Ant but I
could be wrong....
Rhino
----- Original Message -----
From: "Bob Noonan" <no...@cs.wm.edu>
To: <us...@ant.apache.org>
Sent: Friday, October 28, 2005 2:17 PM
Subject: Need to expand *.txt in java task
> Hi,
>
> Please forgive my stupidity, but I have spent hours on this ...
>
> Given the following Unix/Linux command line:
>
> java Test.Main -all *.txt
>
> I wrote the following ant task:
>
> <java classname="Test.Main">
> <arg value="-all" />
> <arg value="*.java" />
> </java>
>
> Test.Main reports it cannot find file *.java.
>
> So I replaced the 2nd arg with a <fileset ... />.
> The ant java task reports that it does not accept <fileset>'s.
>
> Similarly, I tried nesting a fileset within an arg. Illegal.
>
> I checked the O'Reilly Ant book and ant.apache.org
> without finidng a solution.
> I am clearly missing something. It should not be this hard.
>
> Thanks,
> Bob
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 27/10/2005
>
>
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.12.5/150 - Release Date: 27/10/2005
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org