ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbjk <j...@mac.com>
Subject Re: Ant Exiting?
Date Fri, 22 Mar 2002 16:16:37 GMT
I'll try this out. Thanks.  

On Fri, 2002-03-22 at 16:10, Craig Minton wrote:
> Try calling Ant build by using the Project class:
> 
>       String buildXmlFile = "build.xml";
>       File dir = new File( "E:/myproject" );
> 
>       Project pj = new Project( );
>       pj.init( );
>       // Add the default listener
> 
>       // Check the createLogger() method in Main.java
>       pj.addBuildListener( createLogger( ) );
> 
> 
>       try
>       {
>         File file = FileUtils.newFileUtils( ).resolveFile( dir,
> buildXmlFile );
>         buildXmlFile = file.getAbsolutePath();
> 
>         pj.setBaseDir( dir );
>         pj.setUserProperty( "basedir" , dir.getAbsolutePath( ) );
> 
>         // Set properties, if needed
>         pj.setProperty( "user", user );
> 
>         // Add your build listeners, if needed
>         pj.addBuildListener( new MyBuildListener( ) );
> 
> 
>         File bldFile = new File ( buildXmlFile );
>         pj.setUserProperty( "ant.file" , buildXmlFile );
>         ProjectHelper.configureProject( pj, bldFile );
>       }
>       catch ( BuildException be )
>       {
>          be.printStackTrace( );
>       }
>       pj.executeTarget( buildTarget );
> 
> 
> -Craig
> 
> ----- Original Message -----
> From: <jbjk@mac.com>
> To: <ant-user@jakarta.apache.org>
> Sent: Friday, March 22, 2002 9:13 AM
> Subject: Ant Exiting?
> 
> 
> > If I use Ant in another Java application and call it via the 'start'
> > method on
> > Main, if the build fails the JVM is closed, i.e. so is the calling
> > application.
> >
> > Is there any way to call Ant without having System.exit called to
> > signify the end of execution.
> >
> > -John K
> >
> >
> > --
> > 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>
> 



--
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