Solved

using ant to modify java file

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Maven Project: Hibernate Dependencies Conflict 10 95
Convert from a json string array to a Java object 3 81
How to log java errors in tomcat 8 39
Java array 10 89
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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

752 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