ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manju Sarala Viswam <mvis...@vanenburg.com>
Subject RE: Executing an Ant build from a Java class
Date Fri, 27 Jun 2003 03:45:17 GMT
Hi ,
        You can try this :
1.Create ur build.xml and compile and run the following program.

import org.apache.tools.ant.taskdefs.Ant;
import org.apache.tools.ant.types.*;
import org.apache.tools.ant.*;

import java.io.*;

public class RunningAnt extends Ant
{
        public RunningAnt()
        {
                project = new Project();
                project.init();
                taskType = "ant";
                taskName = "ant";
                setAntfile("build.xml");
                setDir(new File("D:\\rtf\\"));
        }

        public static void main (String []args){
                System.out.println("In main");

                RunningAnt Ra = new RunningAnt();
                Ra.execute();
        }

}

Ant Api's are available with the ant documentation .

Hope I have answered your question 

Regards

Manju S Viswam

-----Original Message-----
From: Richard Hill [ mailto:RHill@classmates.com
<mailto:RHill@classmates.com> ]
Sent: Friday, June 27, 2003 7:49 AM
To: 'user@ant.apache.org'
Subject: Executing an Ant build from a Java class


I'm building a web application using jsp/servlets/struts that will allow a
user to kick off an Ant build script with whatever -Dparams needed. How do
you execute an Ant build in a java class?

Thanks,
Richard Hill


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org




**********************************************************************
The information in this message is confidential and may be legally
privileged. It is intended solely for the addressee. Access to this message
by anyone else is unauthorized. If you are not the intended recipient, any
disclosure, copying, or distribution of the message, or any action or
omission taken by you in reliance on it, is prohibited and may be unlawful.
Please immediately contact the sender if you have received this message in
error.

**********************************************************************


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message