• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to edit files through ant?

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34218
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to edit a file in Ant or do you need a scripting language like BSH?

What I'm really trying to do: I have an application.xml file containing an application client, an ejb and some other things. I want to create an application.xml file that does not contain the application client. So I could edit the file or create a new one. I can't find any file processing tasks in Ant or Ant contrib. Am I missing them?

Thanks,
Jeanne
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34218
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think posting this made me lucky! I just found an article that gives an example using "copy" and "filterchain."

Or I could use "loadfile" and then ant contrib's regular expression handling. That looks more promising for dealing with XML.
[ September 15, 2005: Message edited by: Jeanne Boyarsky ]
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18098
50
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is one danger, however. If you put test subsititution in your copy, Ant will assume that ALL files in the copy are text files and treat them as such.

I had Ant shred a bunch of image files because I was copying them as part of a directory subtree containing config files and the DOS text conversion took all the 0x0A's in the binary images and made them 0x0A0D sequences.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34218
341
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim,
Thanks for the words of warning.

I got it to work by doing:


In hindsight, this was rather simple to do.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic