ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg 'Cosmo' Haun <GH...@cenquest.com>
Subject RE: invoking ant from jsp on win2k
Date Sun, 15 Sep 2002 21:53:53 GMT
Here is how we launch ant from JSP using Tomcat on Win98; certainly a
different approach than yours.  Starts up a new JVM but that doesn't seem to
be a problem for us.

<%@ page import="java.io.*" %>
<%
out.print("Starting Build<p>\n");
String buildfile = request.getParameter("buildfile");
String options = request.getParameter("options");
if (options == null) options = "";
String ANT_HOME = "ant-1.5";

String[] env = {"Classpath=c:\\" + ANT_HOME + "\\lib\\ant.jar;" + 
				"c:\\" + ANT_HOME + "\\lib\\JAKART~1.JAR;" +

				"c:\\" + ANT_HOME + "\\lib\\jaxp.jar;" +
				"c:\\" + ANT_HOME +
"\\lib\\NetComponents.jar;" +
				"c:\\xalan-j_2_3_1\\bin\\xalan.jar;" + 
				"c:\\xalan-j_2_3_1\\bin\\xml-apis.jar;" + 
	
"c:\\Apache_Group\\jakarta-tomcat\\lib\\mm.mysql-2.0.2-bin.jar;" +

				""};


String execline = 	"java " +
					"-Dant.home=c:\\" + ANT_HOME + " " +
					"org.apache.tools.ant.Main " +
					"-verbose " +
					"-logfile C:\\" + ANT_HOME +
"\\testlog.txt " +
					"-buildfile " + buildfile +
					" " + options +
					"";


Runtime runTime = Runtime.getRuntime();					
Process myProcess = runTime.exec(execline, env);
out.println(execline + "<br>" + env[0] + "<br>");
out.flush();
%>


Gregory Cosmo Haun
Architect, Interactive Development
Cenquest, Inc.

Phone: 503.276.7943
Email: ghaun@cenquest.com

Learn more about Cenquest collaborative e-learning at www.cenquest.com


> -----Original Message-----
> From: Stefan Lipp [mailto:s.lipp@tallence.com]
> Sent: Friday, September 13, 2002 7:08 AM
> To: ant-user@jakarta.apache.org
> Subject: invoking ant from jsp on win2k
> 
> 
> sorry for another post, but all previous solutions mentioned 
> didn't work.
> 
> My case plain spoken:
> Used API in jsp and tried to fire up ant with given path to build-file
> which works all in a dos-box:
> <%@ page import="org.apache.tools.ant.Project"%>
> <%@ page import="org.apache.tools.ant.taskdefs.ExecTask"%>
> <%@ page import="org.apache.tools.ant.types.Commandline"%>
> <html>
> <head><title>invoke_ant</title></head>
> <body>
> <%
>     Project project = new Project();
>     ExecTask exec = new ExecTask();
>     exec.setProject(project);
>     exec.setExecutable("ant.bat");
>     Commandline.Argument arg = exec.createArg();
>     arg.setLine("-buildfile
>     e:/jakarta-tomcat-3.2.3/webapps/vignette_dev/build.xml"); 
>    exec.execute();
> 
> %>
> </body>
> </html>
> 
> tomcat error:
> 
> javax.servlet.ServletException: Execute failed: java.io.IOException:
> CreateProcess: ant.bat -buildfile
> e:/jakarta-tomcat-3.2.3/webapps/vignette_dev/build.xml error=2
> What went wrong? Is it that f...ing windows? Does sombody has 
> a solution?
> 
> thx
> 
> Stefan s.lipp@tallence.com
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: 
> <mailto:ant-user-help@jakarta.apache.org>
> 

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


Mime
View raw message