Ant - How do you use it?

S

Stuff

Our build process has always used make but
more and more parts are migrating to ant,
because it seems to do the java bits better.

At this point I think we'll migrate entirely
to ant. Running all javac, java, jar, other
commands from a single vm boosts our build time
and ant integrates well with IDEs.

The newest ant release adds macro's and import's
which solve some of the worst usability problems.

I've never hated XML as much as some
people do. There are alot of good tools for working
with XML and my programmers are used to it.
I've read that the original developer thinks that
was a huge mistake, but the sucess of ant shows
he's probably wrong.

I've read posts where people blame difficulty of
use on XML, but I think its just limited verbs in
pure ant, particularly for conditionals.

I observe that the apache partitions ant
deployment into a core and a contrib set
of tasks, where the core is idealogically
pure.

I interpret ideallogically pure to mean
declaritive. You have to do cute and
clever things to get conditional or procedural
behavior into you're scripts.

So far I've been able to do everything I need in
pure ant, but I have to think too hard sometimes.
I have more confidence that the next guy wont
screw up what I've done, because he lacks easy
tools to screw up with. Its kind of smelly though.

There's a rich set of ant add-ons which make it
easy to do all kinds of procedural tasks and turn
ant into an extensible scripting language with a
rich set of open source extensions.

Extensions like 'If' and 'foreach' are obviously useful, but they
make it easy to bypass the 'pure' approach. I
haven't decided if this is a good thing or not.

Contrib tools also make it harder to google for
docs. I've read posts on this forum from people
who hate the online ant documentation, but I've
found it to be very clear, consistent and always
have useful examples.

To go even further out-of-the-box, ant allows embedding
scripting languages such as python or ruby. Anyone
ever tried this? Nice or nasty? Fast or slow?

Ant also recommends a build hierarchy. I'm curious
whether this is widely used. This is one of those
things where I think the most common approach is
better than the 'best' approach.

Anyway, before I dump this on my team, I wanted to
to get feedback and opinions on ant and usage models.

I've read RG's page on it, and found it helpful but
a little out of date. Thanks for writing it though,
strong work.

Cheers, Wibble
 
S

Scott Ellsworth

We built a quite extensive build system around ant. A hundred fifty
projects with dependencies, a bunch of generated code, and three
platforms/four IDEs to manage. Ant, by itself, built things without
problems, but we needed more than ant provided out of the box. I wrote
a few tasks, then wrote an overarching build file that let ant manage
overall project dependencies as well as the individual project builds.

Before I worked with Maven, I thought of our build system as heading
towards Maven. I now do not think so - we had a similar goal, but I
find Maven to add way too much cruft, and to be a bit too aggresive
about how your project needs to be set up.

(IOW, if your project is laid out like Maven likes, and needs what Maven
does, go with it. Otherwise, avoid it.)

Personally, as long as you keep the difference between building a single
project, at which ant excels, and building a list of dependent projects,
at which ant is not so hot, then you can get a lot of good out of ant.
It does a lot, and it integrates well with continuous integration tools.

Stuff said:
To go even further out-of-the-box, ant allows embedding
scripting languages such as python or ruby. Anyone
ever tried this? Nice or nasty? Fast or slow?

I embedded some Javascript in a build once. It worked, but I ended up
using Intercalate (our homegrown Velocity-a-like built years before
Velocity shipped) instead. Worked better for my needs.
Ant also recommends a build hierarchy. I'm curious
whether this is widely used. This is one of those
things where I think the most common approach is
better than the 'best' approach.

The only thing to keep in mind is that ant does not like your source and
your class files to be intermingled. Other than that, I have had no
problem getting things to work.
Anyway, before I dump this on my team, I wanted to
to get feedback and opinions on ant and usage models.

It works well. It has problems, and if you discover that you are trying
to turn it into a programming language, you will find those. That said,
if you stick to the things it does - building, using existing tasks,
writing new tasks for your needs - then it works very well.

Scott
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top