ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Fetzer <elstonk...@yahoo.com>
Subject Re: Doing Ant builds
Date Fri, 12 Jun 2009 16:32:03 GMT
"solution files" - if you're building .NET, go look at NAnt instead of Ant.  The difference
is similar to that of a Volkswagon Beetle vs. Rolls Royce...




________________________________
From: "Ina, Antoine" <antoine.ina@philips.com>
To: Ant Users List <user@ant.apache.org>
Sent: Thursday, June 11, 2009 11:58:37 AM
Subject: RE: Doing Ant builds

I am posing a general question about Ant vs Make vs Batch:
1- What is advantage of Ant script over regular Batch script that calls up the solution files
for all the projects in
  your system tree of projects(for Windows platform)
2- How does Ant handle up and down project dependencies

Regards,
Antoine

-----Original Message-----
From: Ashley Williams [mailto:ashpublic@mac.com]
Sent: 2009 Jun 11 12:52 PM
To: Ant Users List
Subject: Re: Replacing build.xml with Build.java - Doing Ant builds directlyfrom Java

Hi Dean,

I use this technique frequently as in this example lifted straight
from my code, see below.
All you have to remember is that a top level project owns many targets
which in turn own many tasks,
so just make sure you set up the parent/child references in both
directions.

                // create the ant parent project
                Project project = new Project();
                project.setName("project");
                project.init();

                // create the child target
                Target target = new Target();
                target.setName("target");
                project.addTarget(target);
                project.addBuildListener(new Log4jListener());

                // create the child untar task with gzip compression
                Untar untar = new Untar();
                untar.setTaskName("untar");
                untar.setSrc(artifactFile);
                untar.setDest(new File("."));
                Untar.UntarCompressionMethod method = new
Untar.UntarCompressionMethod();
                method.setValue("gzip");
                untar.setCompression(method);
                untar.setProject(project);
                untar.setOwningTarget(target);
                target.addTask(untar);

                project.execute();

I am also the architect of ProtoJ over at google code http://code.google.com/p/protoj/
  which builds on ant and other
dependencies to control a project from java rather than script.

- Ashley



On 11 Jun 2009, at 16:28, Dean Schulze wrote:

>
> The Ant documentation has a section titled "Using Ant Tasks Outside
> of Ant" which gives a teaser for how to use the Ant libraries from
> Java
> code.  In theory it seems simple enough to replace build.xml with
> Build.java. The Ant documentation hints at some undocumented
> dependencies that I'll have to discover (undocumented from the point
> of
> view of using Ant from within Java).
> Using Java instead of xml to do an Ant build seems so obvious I
> wonder why there hasn't been a parallel track over the years for
> Build.java as well as build.xml.
> I asked this same question over at stackoverflow.com:
> http://stackoverflow.com/questions/972574/replacing-build-xml-with-build-java-using-java-and-the-ant-libraries-as-a-build
> The answers indicate that it isn't difficult to do, but that it is
> necessary to "spoof" the project and target objects.
> While it all looks encouraging I haven't seen any actual examples of
> how to deal with the undocumented issues mentioned.  Has anyone
> documented how to do Ant builds from Java?
> Thanks.
> Dean
>
>
>
>


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


The information contained in this message may be confidential and legally protected under
applicable law. The message is intended solely for the addressee(s). If you are not the intended
recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction
of this message is strictly prohibited and may be unlawful. If you are not the intended recipient,
please contact the sender by return e-mail and destroy all copies of the original message.

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


      
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message