File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ant, Maven and Other Build Tools and the fly likes How to read content of a file ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Reply Bookmark "How to read content of a file ?" Watch "How to read content of a file ?" New topic
Author

How to read content of a file ?

Stefan Geelen
Ranch Hand

Joined: Nov 19, 2001
Posts: 49
hi,
I have a build.xml file that does a lot of things and then in the end there is a .zip file generated.
In a .txt file there are a set of file-names reprenting the names of the .zip files to be generated.
I would like to make a loop so that the build.xml file is called as many times as there are filenames in the .txt file (passing the name to the build file).
I could do this with a batch file (under DOS) that reads the .txt file and then calls the build.xml file.
Is there a possibility I could do this entirely with Ant (maybe 2 ant files - one is reading the filenames and the passing this to the second ant file using <ant> ?)
Any ideas ?
Regards,
Stefan
Loren Rosen
Ranch Hand

Joined: Feb 12, 2003
Posts: 156
You might try the <foreach> task from ant-contrib, http://ant-contrib.sourceforge.net/
Stefan Geelen
Ranch Hand

Joined: Nov 19, 2001
Posts: 49
Hi,
sorry to come back only now but I'm afraid my problem has not been solved.
Can anyone give me an example of how to read the content of a file with <foreach> ant task ?
The file content just contain the names of the files create (one filename per line) :
filename1
filename2
filename3
..

Thanks
Stefan
 
 
subject: How to read content of a file ?
 
Threads others viewed
zipping files: problems with german umlauts in filename
How to use Aspirin
Buildfile: build.xml does not exist! Build failed
Compilation of the java files in folders
zip file does not contain any text file ??
IntelliJ Java IDE