Solved

using ant to modify java file

Posted on 2004-10-15
6
228 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
  • 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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 will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

707 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now