using ant to modify java file

I use ant - build.xml to compile java files and archive ear files.
Are there any ways that I can use the build.xml to modify a java file (add/delete one line at the end of a java file) b4 I use ant to build all the .class files?

It's a long story to explain why I wanna do this. So, in short, I just HAVE to do it.

Thank you very much!!
hung2003Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
objectsConnect With a Mentor Commented:
The replace task may help.
worst case you'd need to write your own task.
0
 
Tommy BraasCommented:
Hi hung2003,

I would suggest that you write a simple Ant task to accomplish this. All you need to do is extend the org.apache.tools.ant.Task class, and override the execute() method. See the Ant docs for more information and examples with code: http://ant.apache.org/manual/index.html

Cheers!

\tt
0
 
objectsCommented:
filter task may also help
0
 
Tommy BraasConnect With a Mentor Commented:
hung2003,

Here's a direct link to the appropriate pages: http://ant.apache.org/manual/develop.html#writingowntask

\t
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.