I thought it might be helpful being able to build our project, using
ANT, without having to connect with SSH or Telnet. After looking around
with little luck I decided to write my own JSP page to do this.
Even though it wasn't very hard I though maybe people here would be
interesed, so I share the source with you.

All you have to do is change the path to your build.xml file (assuming
you have ANT in your path, that is).

Note that I have not considered any security issues, such as revealing
path info on your server. If you are conserned about this you could add
the -quiet parameter to ant.

_______________________BEGIN___________________________
<%@ page import="java.io.*" %>

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">

<html>
<head>
  <title>Build using ANT</title>
  <meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
</head>

<body>
<h2>Building using ANT</h2>
<font size="+1">
<nobr>
<pre>
<%
  // Change this line to your path!
  //  |
  //  V
  String buildFile = "/usr/project/build.xml";

  Runtime runtime = Runtime.getRuntime();
  Process process = runtime.exec("ant -buildfile " + buildFile);
  InputStreamReader isr = new InputStreamReader(
process.getInputStream() );
  BufferedReader br = new BufferedReader( (Reader)isr );
  try
  {
    String line;
    while( (line = br.readLine() ) != null ) // Get the next line
      out.println( line );                   // Print it
  }
  catch(IOException ioex)
  {
    out.println("<p><br>" + ioex.getMessage() );
  }

%>
</pre>
</nobr>

<p>
<h2><a href="javascript:location.reload()">Build again</a></h2>

</font>
</body>
</html>
_______________________END_____________________________


  Mattias Jiderhamn
  Expert Systems
  [EMAIL PROTECTED]
�

==========================================================================To 
unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to