Solved

using ant to modify java file

Posted on 2004-10-15
6
236 Views
Last Modified: 2008-03-10
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!!
0
Comment
Question by:hung2003
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
6 Comments
 
LVL 92

Accepted Solution

by:
objects earned 250 total points
ID: 12324850
The replace task may help.
worst case you'd need to write your own task.
0
 
LVL 14

Expert Comment

by:Tommy Braas
ID: 12324853
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
 
LVL 92

Expert Comment

by:objects
ID: 12324856
filter task may also help
0
 
LVL 14

Assisted Solution

by:Tommy Braas
Tommy Braas earned 250 total points
ID: 12324858
hung2003,

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

\t
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question