ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joseph Campbell <jcampb...@inventa.com>
Subject Re: Embedding Ant...
Date Mon, 21 Jul 2003 21:24:11 GMT
This was PERFECT.  I have my little ant thing, compiling its needed tasks on 
the fly for the process I am writing.  Everything is perfect.
	Thanks you very much for your help.

Joe
On Friday 18 July 2003 5:05 pm, Antoine Lévy-Lambert wrote:
> Joseph :
>
> here is one class which I wrote to run a part of the official tests of the
> jar task in ant.
> What you want to write to embed ant can be something like this.
> Write a build.xml file somewhere and with the sequence of function calls
> you see here you can call some targets of your build.xml
> It is also possible not to write any build.xml and to create your targets
> and your tasks programmatically, but I do not have an example for that at
> hand.
> Cheers,
> Antoine
>
> package com.tonisoft;
>
> import org.apache.tools.ant.*;
>
> import java.io.File;
>
> /**
>  * Created by IntelliJ IDEA.
>  * User: administrator
>  * Date: Jan 21, 2003
>  * Time: 2:25:50 PM
>  * To change this template use Options | File Templates.
>  */
> public class testjartask {
>     public static void main (String [] argv){
>
>         //String filename="/dev/testant/build.xml";
>         String
> filename="/dev/gnu/ant/jakarta-ant/src/etc/testcases/taskdefs/jar.xml";
>         StringBuffer logBuffer;
>         StringBuffer fullLogBuffer;
>         Project project=new Project();
>         logBuffer = new StringBuffer();
>         fullLogBuffer = new StringBuffer();
>         project = new Project();
>         project.init();
>         project.setUserProperty( "ant.file" , new
> File(filename).getAbsolutePath() );
>         ProjectHelper.configureProject(project, new File(filename));
>         project.addBuildListener(createLogger());
>         //project.executeTarget("cleanup");
>         project.executeTarget("test4");
>         project.executeTarget("testRecreateNewerFileSetup");
>         project.executeTarget("testRecreateWithUpdateNewerFile");
>     }
>     private static BuildLogger createLogger() {
>         BuildLogger logger = null;
>         logger = new DefaultLogger();
>         logger.setMessageOutputLevel(Project.MSG_INFO);
>         logger.setOutputPrintStream(System.out);
>         logger.setErrorPrintStream(System.err);
>         logger.setEmacsMode(false);
>
>         return logger;
>     }
> }
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org

-- 
I wonder if there is anyone in the world who works harder 
at anything than American school kids work at popularity. 
Navy SEALs and neurosurgery residents seem slackers by 
comparison.
     - Paul Graham
-----------------------------------------------------
Joseph Campbell      | EMAIL: jcampbell@inventa.com
Staff Consultant     | URL:   www.inventa.com
Inventa Technologies | PH:    (856)914-5200
                     | PGER:  (888)454-0876
-----------------------------------------------------


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


Mime
View raw message