Hi ! Any idea how I will run Ant from a servlet. Basically I want to build an application when the servlet receives a request. Danish
Maulin Vasavada
Ranch Hand
Joined: Nov 04, 2001
Posts: 1865
posted
0
Hi Danish I guess you are looking for Runtime.exec() functionality...basically you would do something like, Runtime r = Runtime.getRuntime(); r.exec(new String[]{"/usr/bin/ant","<<your target>>"}); Note that I am using the String[] argument method as that is the good way I guess to invoke commands as the String argument method causes confusions sometimes and doesn't do what we want..I always go with String[] method.. google more for how to use exec() from java... Regards Maulin
Hi There is a class called "Project" under org.apache.tools.ant package available along with ant libraries. you will be able to create a project and assign the build xml file for a specific build, using "Project" class. The following methods in Project class can be used to create a project. init(); setUserProperty("ant.file", buildfile); executeTarget(target); Project can be configured using "ProjectHelper" available in the same package. After creating and configuring a project, start the build, using "executeTarget" method. -Akbar SCJP SCWCD
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.