File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes Ant has no robust insert capability Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Ant has no robust insert capability" Watch "Ant has no robust insert capability" New topic

Ant has no robust insert capability

James Ellis
Ranch Hand

Joined: Oct 14, 2004
Posts: 205
From what I have found, there really is no way in Ant's core tasks to insert several lines of text into a file without placing a token for each line you are going to insert. Is this correct or can anyone provide a way to do this?
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
Well, how else would you know *where* to insert your lines???

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019

Other than a marker, the only way I can think of is to keep the file in parts and use Ant's file concatenator.

Or is it appender? I forget.
[ January 05, 2005: Message edited by: Tim Holloway ]

Customer surveys are for companies who didn't pay proper attention to begin with.
James Ellis
Ranch Hand

Joined: Oct 14, 2004
Posts: 205

It would be nice if you could insert MULTIPLE lines where this token is. Currently you can only insert one line of text per token. Unless you know otherwise...
James Ellis
Ranch Hand

Joined: Oct 14, 2004
Posts: 205

Just read your earlier post (same forum). Thanks so much. I'll post the solution here for anyone else interested.

I am creating an application using tomcat and mysql. Each customer will get a copy of tomcat with the java code and MySQL with the tables including their accounts/passwords stored in the tables. For each customer we will have a different .sql file to build the database and thus we'll have different sql statements to create accounts for these users.

So...I need to insert into the .sql file some SQL statements to create the accounts for this customer. So in the build.xml file I will have something like this:

and in the install_tables.sql file where I place the token

Ant will replace with the insert statements...on MULTIPLE lines.


is the key.

Thank you very much,
I agree. Here's the link:
subject: Ant has no robust insert capability