You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Duffey, Kevin" <KD...@BUYMEDIA.com> on 2001/08/15 19:32:29 UTC

RE: Build and Confiuration Managment with Ant... a.k.a. running A nt _ from_ JSP/Servlet

That is a kewl idea! My guess is that the XML is not validated right?
Perhaps WebLogic or whatever is trying to validate it? I don't think ANT
scripts use a DTD do they?
 

-----Original Message-----
From: Blackard, Robert [mailto:robert.blackard@tgslc.org]
Sent: Wednesday, August 15, 2001 10:29 AM
To: 'ant-user@jakarta.apache.org'
Subject: Build and Confiuration Managment with Ant... a.k.a. running Ant _
from_ JSP/Servlet



I'm trying to use Ant to provide an automated build an test service on a
testing server.  I've already built Ant scripts (.XML files) that perform
all the tasks related to the process (get for source control, compile,
package, etc.).

Now I'm trying to provide a web page on the testing server used to submit a
request to have a build and test cycle started.  I'm using JDK1.3.1 on
Windows NT 4.0 SP 6, Ant 1.3, WebLogic 6.0 SP2, and Xerces 1.3.0.

Based on the documentation and my experience with Java, I expected to have
my JSP/Servlet perform the following... 

>>>>>>>>>>>>> START <<<<<<<<<<<<< 
    ... 
    String project = request.getParameter( "project" ); 

    try { 
      String args[] = { "-buildfile", "D:/Development/run.xml", "-logfile",
"D:/Development/" + project + ".log", "-D" + project + ".build", "Build" };

      org.apache.tools.ant.Main.main( args ); 
      .... 
    } catch( Exception e ) { 
        ... 
    } 
    ... 
>>>>>>>>>>>>> END <<<<<<<<<<<<< 

where the run.xml is 

>>>>>>>>>>>>> START <<<<<<<<<<<<< 
<?xml version="1.0" encoding="ISO-8859-1"?> 

<project name="run" default="Build" basedir="D:/development"> 

  <!-- set global properties for this build --> 
  <!-- builder.vss - the VSS directory containing build scripts --> 
  <property name="builder.vss.xml" value="/Builder/xml"/> 
  <!-- env - the environment prefix --> 
  <property environment="env"/> 

  <target name="prepare"> 
    <!-- Create the time stamp --> 
    <tstamp> 
      <format property="TIMESTAMP" pattern="MM/dd/yyyy hh:mm a"/> 
    </tstamp> 
    <vssget localPath="${basedir}" 
            login="<user>,<pwd>" 
            vsspath="${builder.vss.xml}/builder.xml" 
            writable="false"/> 
  </target> 

  <target name="Proj1" if="Proj1.build" depends="prepare"> 
    <ant antfile="${basedir}/builder.xml" target="Proj1"/> 
  </target> 

  <target name="Proj2" if="Proj2.build" depends="prepare"> 
    <ant antfile="${basedir}/builder.xml" target="Proj2"/> 
  </target> 

  <target name="Build" depends="Proj1,Proj2"/> 
</project> 
>>>>>>>>>>>>> END <<<<<<<<<<<<< 

I'm getting some odd results, however. 

When I run the above run.xml from a command prompt, everything works fine.
When I trigger the JSP running in WebLogic, I get the following .LOG file

>>>>>>>>>>>>> START <<<<<<<<<<<<< 
Buildfile: D:\Development\run.xml 

BUILD FAILED 

D:\Development\run.xml:8: Config file is not of expected XML type 

Total time: 0 seconds 
>>>>>>>>>>>>> END <<<<<<<<<<<<< 

and the WebLogic server is outright terminated without any logs or
messsages... as if an exit(0) (yea... I had to resort to C to describe the
behavior... sorry) were being called.

I've tried changing the catch clause to detect RuntimeException and
Throwable as well as Exception, but whatever is occurring isn't triggering a
catch.

Has anyone had any experience setting something like this up, or seen the
behavior I'm describing? 


Re: Build and Confiuration Managment with Ant... a.k.a. running Ant _ from_ JSP/Servlet

Posted by Lauren Commons <lh...@yahoo.com>.
Tip: 
You can't start from here:
> >       org.apache.tools.ant.Main.main( args );
> >       ....

Check the Ant source code, which will provide pretty
specific instructions.  Basically, you need to start
at the Project class level.

Look at Main() to see what methods to call, but call
them yourself directly.

Good luck!

=====
-------------------------
Mr Lauren Commons
A person of moderate zeal

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

Re: Build and Confiuration Managment with Ant... a.k.a. running Ant _ from_ JSP/Servlet

Posted by Stephane Bailliez <sb...@apache.org>.
You might get your hands on cruisecontrol that demonstrate how to do this.
About the System.exit(), that's somewhat normal, you have to change the
security manager when running Ant.

http://cruisecontrol.sourceforge.net

Stephane

----- Original Message -----
From: "Duffey, Kevin" <KD...@BUYMEDIA.com>
To: <an...@jakarta.apache.org>
Sent: Wednesday, August 15, 2001 7:32 PM
Subject: RE: Build and Confiuration Managment with Ant... a.k.a. running Ant
_ from_ JSP/Servlet


> That is a kewl idea! My guess is that the XML is not validated right?
> Perhaps WebLogic or whatever is trying to validate it? I don't think ANT
> scripts use a DTD do they?
>
>
> -----Original Message-----
> From: Blackard, Robert [mailto:robert.blackard@tgslc.org]
> Sent: Wednesday, August 15, 2001 10:29 AM
> To: 'ant-user@jakarta.apache.org'
> Subject: Build and Confiuration Managment with Ant... a.k.a. running Ant
> _ from_ JSP/Servlet
>
>
>
> I'm trying to use Ant to provide an automated build an test service on a
> testing server.  I've already built Ant scripts (.XML files) that
> perform all the tasks related to the process (get for source control,
> compile, package, etc.).
>
> Now I'm trying to provide a web page on the testing server used to
> submit a request to have a build and test cycle started.  I'm using
> JDK1.3.1 on Windows NT 4.0 SP 6, Ant 1.3, WebLogic 6.0 SP2, and Xerces
> 1.3.0.
>
> Based on the documentation and my experience with Java, I expected to
> have my JSP/Servlet perform the following...
>
> >>>>>>>>>>>>> START <<<<<<<<<<<<<
>     ...
>     String project = request.getParameter( "project" );
>
>     try {
>       String args[] = { "-buildfile", "D:/Development/run.xml",
> "-logfile", "D:/Development/" + project + ".log", "-D" + project +
> ".build", "Build" };
>
>       org.apache.tools.ant.Main.main( args );
>       ....
>     } catch( Exception e ) {
>         ...
>     }
>     ...
> >>>>>>>>>>>>> END <<<<<<<<<<<<<
>
> where the run.xml is
>
> >>>>>>>>>>>>> START <<<<<<<<<<<<<
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <project name="run" default="Build" basedir="D:/development">
>
>   <!-- set global properties for this build -->
>   <!-- builder.vss - the VSS directory containing build scripts -->
>   <property name="builder.vss.xml" value="/Builder/xml"/>
>   <!-- env - the environment prefix -->
>   <property environment="env"/>
>
>   <target name="prepare">
>     <!-- Create the time stamp -->
>     <tstamp>
>       <format property="TIMESTAMP" pattern="MM/dd/yyyy hh:mm a"/>
>     </tstamp>
>     <vssget localPath="${basedir}"
>             login="<user>,<pwd>"
>             vsspath="${builder.vss.xml}/builder.xml"
>             writable="false"/>
>   </target>
>
>   <target name="Proj1" if="Proj1.build" depends="prepare">
>     <ant antfile="${basedir}/builder.xml" target="Proj1"/>
>   </target>
>
>   <target name="Proj2" if="Proj2.build" depends="prepare">
>     <ant antfile="${basedir}/builder.xml" target="Proj2"/>
>   </target>
>
>   <target name="Build" depends="Proj1,Proj2"/>
> </project>
> >>>>>>>>>>>>> END <<<<<<<<<<<<<
>
> I'm getting some odd results, however.
>
> When I run the above run.xml from a command prompt, everything works
> fine.  When I trigger the JSP running in WebLogic, I get the following
> .LOG file
>
> >>>>>>>>>>>>> START <<<<<<<<<<<<<
> Buildfile: D:\Development\run.xml
>
> BUILD FAILED
>
> D:\Development\run.xml:8: Config file is not of expected XML type
>
> Total time: 0 seconds
> >>>>>>>>>>>>> END <<<<<<<<<<<<<
>
> and the WebLogic server is outright terminated without any logs or
> messsages... as if an exit(0) (yea... I had to resort to C to describe
> the behavior... sorry) were being called.
>
> I've tried changing the catch clause to detect RuntimeException and
> Throwable as well as Exception, but whatever is occurring isn't
> triggering a catch.
>
> Has anyone had any experience setting something like this up, or seen
> the behavior I'm describing?
>
>