667481 members! Sign up to stay informed.

Sponsored Links


Resources

Enterprise Java
Research Library

Get Java white papers, product information, case studies and webcasts

News News News Messages: 34 Messages: 34 Messages: 34 Printer friendly Printer friendly Printer friendly Post reply Post reply Post reply XML XML XML

Ant and XML Build Files

Posted by: Dion Almaer on April 01, 2004 DIGG
James Duncan Davidson, the creator of Ant, has written about the very beginnings of the project. This history lesson shows us how Ant started out with properties files, and grew to XML... and how in many ways he wished it hadn't.
In retrospect, and many years later, XML probably wasn't as good a choice as it seemed at the time. I have now seen build files that are hundreds, and even thousands, of lines long and, at those sizes, it turns out that XML isn't quite as friendly a format to edit as I had hoped for. As well, when you mix XML and the interesting reflection based internals of Ant that provide easy extensibility with your own tasks, you end up with an environment which gives you quite a bit of power and flexibility of a scripting language—but with a whole lot of headache in trying to express that flexibility with angle brackets.
Read James Duncan Davidson in Ant and XML Build Files

Threaded replies

·  Ant and XML Build Files by Dion Almaer on Thu Apr 01 10:17:12 EST 2004
  ·  Ant and XML Build Files by Sean Sullivan on Thu Apr 01 10:49:44 EST 2004
    ·  Ant and XML Build Files by Cameron Purdy on Thu Apr 01 11:02:22 EST 2004
      ·  Ant and XML Build Files by Diego Parrilla on Thu Apr 01 11:06:52 EST 2004
        ·  Ant and XML Build Files by jamie mccrindle on Thu Apr 01 11:34:48 EST 2004
        ·  Ant and XML Build Files by McCorney Severin on Thu Apr 01 14:47:22 EST 2004
      ·  Java VM is rip off UCSD-P system by Ricky Datta on Thu Apr 01 17:55:37 EST 2004
        ·  Java VM is rip off UCSD-P system by Cameron Purdy on Thu Apr 01 18:08:19 EST 2004
          ·  Turing Machne... by Lyndon Samson on Thu Apr 01 19:54:36 EST 2004
    ·  This has to be an april fools joke by Mike Stanley on Thu Apr 01 12:57:14 EST 2004
    ·  Disagree: XML is fine for very large projects. by Kris Bravo on Fri Apr 02 13:27:07 EST 2004
  ·  not really an XML problem by thoff thoff on Thu Apr 01 11:55:05 EST 2004
    ·  not really an XML problem by Victor Acorda on Thu Apr 01 13:17:10 EST 2004
  ·  Ant and XML Build Files by atus3 . on Thu Apr 01 12:02:19 EST 2004
    ·  Ant and XML Build Files by Aapo Laakkonen on Thu Apr 01 13:23:46 EST 2004
    ·  Ant and XML Build Files by Juozas Baliuka on Thu Apr 01 15:46:25 EST 2004
  ·  Ant and XML Build Files by Ryan Breidenbach on Thu Apr 01 13:39:23 EST 2004
  ·  April Fools by Leo Lipelis on Thu Apr 01 13:41:30 EST 2004
  ·  Ant and XML Build Files by Ryan Breidenbach on Thu Apr 01 13:42:14 EST 2004
    ·  Ant, Rake, SCONS by Sean Sullivan on Thu Apr 01 14:01:39 EST 2004
      ·  Tools need GUI's to expose complexity and increase productivity by davout davout on Thu Apr 01 15:55:30 EST 2004
        ·  Tools need GUI's to expose complexity and increase productivity by Drew McAuliffe on Thu Apr 01 23:42:59 EST 2004
        ·  Tools need GUI's to expose complexity and increase productivity by Valeri Sarantchouk on Sat Apr 03 20:56:19 EST 2004
  ·  Ant and XML Build Files by Hans Schw?bli on Thu Apr 01 13:45:45 EST 2004
  ·  Ant and XML Build Files by Nick Minutello on Fri Apr 02 04:32:27 EST 2004
    ·  Ant and XML Build Files by Toby Reyelts on Fri Apr 02 11:22:15 EST 2004
    ·  Ant and XML Build Files by Hans Schw?bli on Fri Apr 02 16:05:19 EST 2004
      ·  Ant and XML Build Files by Richard Gavel on Fri Apr 02 17:30:15 EST 2004
      ·  Ant and XML Build Files by Nick Minutello on Sun Apr 04 15:31:50 EDT 2004
        ·  Ant and XML Build Files by James Strachan on Mon Apr 05 08:08:04 EDT 2004
  ·  ant-contrib tasks by Sean Sullivan on Fri Apr 02 15:52:28 EST 2004
  ·  Ant's <script> task by Sean Sullivan on Mon Apr 05 12:19:30 EDT 2004
  ·  More discussion... by Sean Sullivan on Mon Apr 05 12:46:35 EDT 2004
  ·  Languages: Groovy, etc by Sean Sullivan on Thu Apr 15 20:16:01 EDT 2004
  ·  Run command from ant by Raghu Nandan on Mon Feb 14 00:08:37 EST 2005
  Message #116170 Post reply Post reply Post reply Go to top Go to top Go to top

Ant and XML Build Files

Posted by: Sean Sullivan on April 01, 2004 in response to Message #116165
Microsoft's new MSBuild utility will use an XML file format:

http://www.iseran.com/Steve/blog/archives/000029.html

http://www.gotdotnet.com/team/PDC/4075/TLS347.zip

  Message #116172 Post reply Post reply Post reply Go to top Go to top Go to top

Ant and XML Build Files

Posted by: Cameron Purdy on April 01, 2004 in response to Message #116170
Looks like Ant is just a copy of MSBuild.

Peace,

Cameron Purdy
Tangosol, Inc.
Coherence: Clustered JCache for Grid Computing!

  Message #116174 Post reply Post reply Post reply Go to top Go to top Go to top

Ant and XML Build Files

Posted by: Diego Parrilla on April 01, 2004 in response to Message #116172
Looks like Ant is just a copy of MSBuild
Just like Java is a rip off C#...

  Message #116181 Post reply Post reply Post reply Go to top Go to top Go to top

Ant and XML Build Files

Posted by: jamie mccrindle on April 01, 2004 in response to Message #116174
Dude, c'mon, ENIAC is obviously a rip off of the JVM.

  Message #116182 Post reply Post reply Post reply Go to top Go to top Go to top

not really an XML problem

Posted by: thoff thoff on April 01, 2004 in response to Message #116165
The problem is big complex configuration files are just big
and complex. The format isn't going to make any significant
difference past a certain point of complexity. You really
need a GUI to manage a complex configuration. Simple things
are fine in an editor. Write the same thing in properties
or s expressions. Still horribly complex to a poor
person armed only with a text editor.

  Message #116185 Post reply Post reply Post reply Go to top Go to top Go to top

Ant and XML Build Files

Posted by: atus3 . on April 01, 2004 in response to Message #116165
Boy is he right. I'm starting to get disgusted by XML already because it is used so much everywhere -- whether it fits the purpose or not. I'm glad I'm not alone to ask "Why?". Some things that never made sense to me:


- XML databases. I don't know why I'd store my data in such an inefficient way.

- XML to "program" something. Just think of the syntactical overhead of a loop or a conditional, in comparison to a foreach loop or an "if" in real programming languges. Tedious.

- parts of the same software system, all from he same vendor, communicate in XML. Hello?!

- XML config files instead of "*.properties", with a few dozens of options

- an amusing one: transforming database data to an XML format, then with XSLT to another, with the info finally winding up in HTML. Sheesh.

Most of these examples taken from our current project! Long live efficiency...


To me, the sensible advantages of XML are (1) it can be a good common communication format BETWEEN different software vendors or platforms, and (2) when (and only when) it must be externally represented, like the XML hierarchical diagrams in XMLSpy. But these are like UFOs to me, never actually seen XML used for these purposes. I know, I haven't been in the business as long as some others :-)

YMMV. I'd actually be happy to read a good use case!

Regards.

  Message #116193 Post reply Post reply Post reply Go to top Go to top Go to top

This has to be an april fools joke

Posted by: Mike Stanley on April 01, 2004 in response to Message #116170
although changing the file format from XML to some sort of script language might "make" sense.

  Message #116195 Post reply Post reply Post reply Go to top Go to top Go to top

not really an XML problem

Posted by: Victor Acorda on April 01, 2004 in response to Message #116182
You reallyneed a GUI to manage a complex configuration. Simple thingsare fine in an editor.
FireAntz, provides a visual interface for displaying and executing Ant buildfiles and their dependencies. I have not tried it yet though. See http://dev.eclipse.org/viewcvs/indextech.cgi/%7Echeckout%7E/ecesis-home/resourceLibrary/downloads/iceContest/iceContestWinners.html.

  Message #116197 Post reply Post reply Post reply Go to top Go to top Go to top

Ant and XML Build Files

Posted by: Aapo Laakkonen on April 01, 2004 in response to Message #116185
> XML databases. I don't know why I'd store
> my data in such an inefficient way.

Storing hierarchical data in relational databases is not very intuitive.

I know three relatively usable methods:

- Joe Celko
  http://www.dbmsmag.com/9603d06.html
- Itzik Ben-Gan
  http://www.winnetmag.com/Articles/Print.cfm?ArticleID=8826
- Bill Graziano
  http://www.sqlteam.com/item.asp?ItemID=1353

  Message #116200 Post reply Post reply Post reply Go to top Go to top Go to top

Ant and XML Build Files

Posted by: Ryan Breidenbach on April 01, 2004 in response to Message #116165
<http://www.martinfowler.com/bliki/BuildLanguage.html</a>>Martin Fowler</a> shares some similar thoughts in his blog.>

  Message #116201 Post reply Post reply Post reply Go to top Go to top Go to top

April Fools

Posted by: Leo Lipelis on April 01, 2004 in response to Message #116165
LOL

  Message #116202 Post reply Post reply Post reply Go to top Go to top Go to top

Ant and XML Build Files

Posted by: Ryan Breidenbach on April 01, 2004 in response to Message #116165
Oops. Let me try this again...

Martin Fowler shares some similar thoughts in his blog:

http://www.martinfowler.com/bliki/BuildLanguage.html

  Message #116204 Post reply Post reply Post reply Go to top Go to top Go to top

Ant and XML Build Files

Posted by: Hans Schw?bli on April 01, 2004 in response to Message #116165
When I was learning Ant I felt that XML is a little bit cumbersome and not very appropriate for Ant files.

I talked with a few people about that impression and started a thread about this topic in a forum. But many people didn't share my opinion in this respect.

So I am very happy that the creator of Ant wrote that XML was not the best choice at that time!

There are not many people who are self-critical. Respect!

How can you debug an Ant file? As soon as someone asks himself this question, he can easily recognize that XML is not the best format for Ant files. Just my opinion.

  Message #116208 Post reply Post reply Post reply Go to top Go to top Go to top

Ant, Rake, SCONS

Posted by: Sean Sullivan on April 01, 2004 in response to Message #116202
http://rake.rubyforge.org/ (Ruby)

http://www.scons.org/ (Python)

  Message #116217 Post reply Post reply Post reply Go to top Go to top Go to top

Ant and XML Build Files

Posted by: McCorney Severin on April 01, 2004 in response to Message #116174
just like java is a cript of c++... and on and on.

peace,

-M

  Message #116227 Post reply Post reply Post reply Go to top Go to top Go to top

Ant and XML Build Files

Posted by: Juozas Baliuka on April 01, 2004 in response to Message #116185
XML is easy to parse with "standard" parsers, I think it made XML popular for scripting, but probably it is better to learn to code parsers than to use XML for evrything (biuld scripts is not an exception too).

  Message #116228 Post reply Post reply Post reply Go to top Go to top Go to top

Tools need GUI's to expose complexity and increase productivity

Posted by: davout davout on April 01, 2004 in response to Message #116208
The one thing that continually strikes me about the java open source tools space is how many of these products are launched without a competent GUI.

In fact I've met a number of otherwise reasonable authorities who suggest that it's somehow "un-manly" to use a GUI wrapper, or that it's "not for real programmers".

Such views are perverse for a couple of reasons.

A capable GUI wrapper can complement the underlying tool by exposing its power through masking the implementation complexities. This leaves the developer to concentrate on solving the business/process problem rather than worrying about a particular syntax. With a strong GUI shell who cares whether its XML or whatever?!?

It can substantilly improve productivity. A competent GUI allows the job to be completed quicker, reduces the skill threshold, and allows problems to be spotted sooner. With the current trend of moving jobs offshore this point should be on everybodies agenda!

  Message #116246 Post reply Post reply Post reply Go to top Go to top Go to top

Java VM is rip off UCSD-P system

Posted by: Ricky Datta on April 01, 2004 in response to Message #116172
wake up and smell the coffee.

JMV is a rip off of UCSD-p system from > 10 years back.

Read it here.

  Message #116250 Post reply Post reply Post reply Go to top Go to top Go to top

Java VM is rip off UCSD-P system

Posted by: Cameron Purdy on April 01, 2004 in response to Message #116246
Chameleon: JMV is a rip off of UCSD-p system from > 10 years back.

Yup, and the UCSD-p system is a straight rip of the Turing Machine.

That took balls to take that one and not acknowledge it ;-)

Peace,

Cameron Purdy
Tangosol, Inc.
Coherence: Clustered JCache for Grid Computing!

  Message #116260 Post reply Post reply Post reply Go to top Go to top Go to top

Turing Machne...

Posted by: Lyndon Samson on April 01, 2004 in response to Message #116250
What about poor old Charlie Babbages Difference Engine????

  Message #116288 Post reply Post reply Post reply Go to top Go to top Go to top

Tools need GUI's to expose complexity and increase productivity

Posted by: Drew McAuliffe on April 01, 2004 in response to Message #116228
I think there are times when a GUI is faster and times when a config file is faster. Once you cross a certain complexity threshold, GUIs actually slow down the process of working with things. If that weren't the case, WYSIWYG builders for applications would be a lot more useful than they are today. I think there is a place for a GUI when first learning to work with a particular kind of system (e.g, Java Swing programming), but once you understand what's going on, a GUI just gets in the way. Not in all cases, but in a lot. Also, I think that the reason a lot of open source projects don't have GUIs is because a good GUI is hard to write. I'd prefer, for example, that Hibernate concentrate on its core functionality than spend resources perfecting a GUI that might or might not see use.

I think personally that there's a place for both. Just as in the OS world, I prefer a combination of command line and GUI control, I prefer a combination of direct coding and GUI control. A GUI is great for helping to manage complexity, but if something can't be done outside of a GUI, there are severe limitations. Consider, for example, trying to manage a website using just notepad. You'd be foolish, because you need something like an IDE to manage complexity. Consider also trying to edit an HTML file to change a style. You could open it up in a text editor and make the change really quickly with a search and replace, or you could go into the GUI and find a properties window somewhere for each instance of a control that you want to change the style on. There's a strong case for both.

I certainly don't think that a GUI alone can do everything, and when dealing with things like deployment configurations, I think GUIs can just get in the way.

  Message #116320 Post reply Post reply Post reply Go to top Go to top Go to top

Ant and XML Build Files

Posted by: Nick Minutello on April 02, 2004 in response to Message #116165
It seems I continually find myself on the wrong side of fashion.... :-(

I was having this same discussion the other day with someone (check out his fish!). I think Ant - and even Jelly are a good compromise for build systems.

Why?

Because its mostly declarative - not programmatic.

Consider:

<copy file="bongo.jar" todir="bollocks/lib" overwrite="false"/>

Looking past the (often exaggerated) angle-brackets aspect of readability, it is very clear what this is going to do - even if you have never seen Ant before. It is very brief and very unambigious.

I would be keen to see suggestions on how this could be done clearer in Python or Ruby. Or even Groovy.

Where ant starts to fall apart is when you want to do a load of conditional or iteration or more programmatic tasks. At that point, you want to write your own tags - and defer to a proper programming language. I dont thinke enough people do this. I dont know why.

The other place where Ant falls apart (referred to in the article) is when you have a large project - or many subprojects. The verbosity of Ant (and monotonous repetition of tasks) makes it a sea of text that, regardless of the angle-brackets, would make it difficult to read. (anyone tried reading a 6000-line java file?)

Here, Maven and Centipede have tried to address this by factoring out common tasks. With the Maven project.xml, you are back to a purely declarative approach that is very readable and maintainable...

-Nick

  Message #116364 Post reply Post reply Post reply Go to top Go to top Go to top

Ant and XML Build Files

Posted by: Toby Reyelts on April 02, 2004 in response to Message #116320
First I'd like to say:

OMG! So I'm not the only one who's been extremely annoyed by Ant XML config files. I actually suggested to one of my team mates, a couple of weeks ago, that we develop a custom domain-specific language (DSL) for Ant, because the config files were such a PITA. Moving along...
Consider:

<copy file="bongo.jar" todir="bollocks/lib" overwrite="false"/>

Looking past the (often exaggerated) angle-brackets aspect of readability, it is very clear what this is going to do - even if you have never seen Ant before. It is very brief and very unambigious.

I would be keen to see suggestions on how this could be done clearer in Python or Ruby. Or even Groovy.
I think the reason you see this as readable, is because element attributes are named. If the Ant DSL had named parameters (like many other languages - for example, Smalltalk), this would be just as readable:

copy( file="bongo.jar", todir="bollocks/lib", overwrite="true" );

And with a DSL, people could easily provide their own higher level abstractions complete with control flow if necessary.

God bless,
-Toby Reyelts

  Message #116392 Post reply Post reply Post reply Go to top Go to top Go to top

Disagree: XML is fine for very large projects.

Posted by: Kris Bravo on April 02, 2004 in response to Message #116170
While I agree that build scripts can get out of hand quickly, I don't agree that this is amplified by the use of xml. This is the fault of some strategically placed documentation with ill advice, and lack of planning on behalf of whomever create the script.

In perusing the documentation available for ant, I've noticed advice about global targets and calls to other scripts which make maintenance a nightmare. The focus seems to be on getting the project build where half the thought should be given to future changes. Stop considering the overall organization of the script and you will pay for it later.

You can create a generic script which tackles the various types of Java deployments- application, applet, webstart app, war, ejb, ear, sar, etc - and allows the incorporation of other build facilities such as torque, without things getting out of hand and without restricting yourself. It's slower than slapping a build.xml file together and letting it evolve without regard, but much more enjoyable to work with and faster in the long run.

Here are some basic ideas:

1) Break the script into logical files using XML entity imports.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project [
  <!ENTITY general SYSTEM "file:../../Build/general.xml">
  <!ENTITY library SYSTEM "file:../../Build/library.xml">
  <!ENTITY cvs SYSTEM "file:../../Build/cvs.xml">
  <!ENTITY j2ee SYSTEM "file:../../Build/j2ee.xml">
  <!ENTITY format SYSTEM "file:../../Build/format.xml">
  <!ENTITY servers SYSTEM "file:../../Build/servers.xml">
  <!ENTITY testing SYSTEM "file:../../Build/testing.xml">
  <!ENTITY xml SYSTEM "file:../../Build/xml.xml">
  <!ENTITY application SYSTEM "file:../../Build/application.xml"> ]>

<!--======================================================================
Main build targets and project specific information.
=======================================================================-->
<project basedir=".." default="nightly" name="ProjectName">

   <!-- ==================================================================
   What to deploy when we say deploy
   ====================================================================-->
   <target name="deploy.all" depends="deploy.ear, deploy.test">
   </target>

  &general;
  &library;
  &cvs;
  &j2ee;
  &format;
  &metrics;
  &servers;
  &testing;
  &xml;
  &application;

</project>

Each referenced file keeps targets, taskdefs, and classpaths that directly relate to the file - e.g., the compile.ejb target is in j2ee.xml.

2) make an accompanying .properties file for each .xml file. Have the .xml import the .properties, and keep your key names consistent.

3) Keep your project specific files in a separate location from the generic build scripts. This include files which contain classpaths for each type of compile, settings for filters, names of ftp servers to post reports to, etc. If you believe the generic script sections will get used elsewhere and prepare for it, it will happen and other people will get it when you explain the intent.

Since I've started this effort, I've never used another script on development efforts I've worked on. All of my changes to accomodate the new project have stayed within a file called localproject.properties for my development and project.properties for the nightly builds.

So James might have seen some cases where the build became quite a mess, but it's no more the fault of the his choice of xml than a messy playroom is the fault of a particular type of plastic. Kid's are just messy.

  Message #116420 Post reply Post reply Post reply Go to top Go to top Go to top

ant-contrib tasks

Posted by: Sean Sullivan on April 02, 2004 in response to Message #116165
for loops, if statements, try/catch/finally:

http://ant-contrib.sourceforge.net/tasks/index.html

:-)

  Message #116422 Post reply Post reply Post reply Go to top Go to top Go to top

Ant and XML Build Files

Posted by: Hans Schw?bli on April 02, 2004 in response to Message #116320
Because its mostly declarative - not programmatic.Consider:<copy file="bongo.jar" todir="bollocks/lib" overwrite="false"/>Looking past the (often exaggerated) angle-brackets aspect of readability, it is very clear what this is going to do - even if you have never seen Ant before. It is very brief and very unambigious.I would be keen to see suggestions on how this could be done clearer in Python or Ruby. Or even Groovy.
You need to see the big picture, not just a single example.

In most cases targets are called from another targets with "depends". This is not declarative for me, but programmatic. int a = 0 is also declarative for you? Is this an argument that Java should better use XML? There are many other programmatic features of Ant build files.

How do you want to debug a Ant script? If Ant build scripts were written in Java, this would be possible. It would also be possible to detect many bugs at compile time and not later at runtime. How do you want to write a productive JUnit test for your Ant scripts?

When someone learns Ant, he has to learn that pseudo Ant script which is hidden in a declarative XML format. In order to write build files one must learn the declarative and programmatic aspects of Ant. Its in no practical case enough to learn only the declarative part of Ant.

For example XHTML is very good for its purpose because its 99% declarative. Programmatic things are done with JavaScript. There is a clean separation: XHTML for the declarative things, JavaScript for the programmatic. Now try to separate that in Ant build files! Would not make sense. If it is such a mixture, then it is a sign that XML is not such a good choice for it.

Of course XML has the advantage that someone must not learn a programming script in order to use it. On the other side, he must learn the programmatic part of Ant, which decreases this advantage a little bit. But I doubt that this advantage is practical. I believe that 99% of the people who use Ant are programmers. Maybe only 1% of the Ant script writers are system administrators with no programming knowledge. So even if it is an advantage in this respect, its only an advantage to 1% of the Ant users.

  Message #116436 Post reply Post reply Post reply Go to top Go to top Go to top

Ant and XML Build Files

Posted by: Richard Gavel on April 02, 2004 in response to Message #116422
1. It's clear that if/else and try/finally constructs being written imply Ant has stepped over the line from good design to copying language constructs. However, I don't know if this implies that using a scripting language is that natural evolution. It might just mean that more needs to be done in task classes and not in build XML, or just better designed build files.

2. I don't see how tasks dependencies are better defined programmatically rather than declaratively. Doing it programmatically requires writing code that executes the tasks in order based on dependency. Do you really care what order they get executed, as long as tasks A & B get done before F? If I were to do this in scripting form, many of my targets would be methods and depends would become metadata of the method.

  Message #116518 Post reply Post reply Post reply Go to top Go to top Go to top

Tools need GUI's to expose complexity and increase productivity

Posted by: Valeri Sarantchouk on April 03, 2004 in response to Message #116228
I agree with Drew. There is time and place for GUI tools and for plain text editing. There are times when you need a convenient GUI – e.g. to quickly write, validate or transform a large XML document with some XML editor, or analyze java structure of the project with SA4J. At the same time it is often advantageous to be able to edit the same source file (especially XML-based) with a plain text editor. Having no choice but to use the vendor-given GUI per task is not a good thing. Back to Ant, I find Intellij and Jbuilder support of Ant quite good.

About the article:
I always missed some sort of scripting language in Ant for control flow. It’s not needed in 90% of cases, but would really help in those rare but crutial 10%. Still, if such scripting language had been available, I think, we would have seen it abused not less as XML is.

Kris Bravo: This is the fault of some strategically placed documentation with ill advice...
:-) The Ant Developer Handbook (Sams) and the Java Development with Ant (Manning) suggest, for example, different approaches to <antcall> task. The former recommend using it instead of “depends” because it facilitates modularization, the latter says that it’s better to let Ant figure out the target dependencies by providing the “depends” info. Well, we have room for experiment :)

  Message #116543 Post reply Post reply Post reply Go to top Go to top Go to top

Ant and XML Build Files

Posted by: Nick Minutello on April 04, 2004 in response to Message #116422
If Ant build scripts were written in Java, this would be possible
And how would you build the build scripts? :-)
This is not declarative for me
I agree with you that ant scripts are not 100% declarative. I guess that is why they are called "scripts" - and I guess thats why also I said they are mostly declarative. Even "depends" is mainly declarative.
You need to see the big picture, not just a single example
Apart from being a little condescending here, you have a point. At the individual task level, ant is mostly declarative. However, unless you follow some build-script styles to avoid it, the relationship between the tasks that make up a project build is lost in the details of the task implementation.

However, as I pointed out, this is not really to do with XML per se - but a lack of abstraction.

Projects sich as Maven and Centipede seek to get a higher level of abstraction - where you have a seperation between the project build and the individual task implementation. You can do the same with ant by yourself if you follow some rules.
a) Dont use "depends" for any of your target definitions.
b) Instead, write higher-level targets that wire the lower level tasks together.

There are a number of advantages to this:
Not using "depends" makes your scripts much easier to debug.
Not hard-coding your dependancies into the individual targets makes your build script more flexible - as the dependancies you want for development are very different to thos you want, say, for your overnight build - or even your cruisecontrol build.

-Nick

  Message #116607 Post reply Post reply Post reply Go to top Go to top Go to top

Ant and XML Build Files

Posted by: James Strachan on April 05, 2004 in response to Message #116543
Incidentally there's an interesting discussion of how you can reuse those Ant tasks for declartive operations but use a real scripting language for procedural logic (and use regular method calling for describing dependencies) here...

http://lists.codehaus.org/pipermail/groovy-user/2004q1/000907.html

There's a test case here to show this kind of thing in action...

http://cvs.groovy.codehaus.org/viewcvs.cgi/groovy/groovy-core/src/test/groovy/util/AntTest.groovy?rev=HEAD&view=auto

James
Core Developers Network

  Message #116656 Post reply Post reply Post reply Go to top Go to top Go to top

Ant's <script> task

Posted by: Sean Sullivan on April 05, 2004 in response to Message #116165
How many developers use Ant's script task?

http://ant.apache.org/manual/OptionalTasks/script.html

  Message #116661 Post reply Post reply Post reply Go to top Go to top Go to top

More discussion...

Posted by: Sean Sullivan on April 05, 2004 in response to Message #116165
http://stefanbodewig.blogger.de/stories/87512/

http://www.iseran.com/Steve/blog/archives/000103.html

  Message #118302 Post reply Post reply Post reply Go to top Go to top Go to top

Languages: Groovy, etc

Posted by: Sean Sullivan on April 15, 2004 in response to Message #116165
Ant scripting with Groovy
http://groovy.codehaus.org/ant.html

BeanShell
http://www.beanshell.org/

Ruby
http://www.ruby-lang.org/en/
http://rake.rubyforge.org/

Jelly
http://jakarta.apache.org/commons/jelly/

Jython
http://www.jython.org/

  Message #156714 Post reply Post reply Post reply Go to top Go to top Go to top

Run command from ant

Posted by: Raghu Nandan on February 14, 2005 in response to Message #116165
Can anybody please tell me how to run a command from ant.

I need to run the following command:

jad -r [-d<directory_for_sources>] [<other_options>] <directory_with_classes>**/*.class

Thanks

New content on TheServerSide.comNew content on TheServerSide.comNew content on TheServerSide.com

Dependency Injection in Java EE 6 - Part 1

Reza Rahman explores the features of the proposed JSR 299, Contexts and Dependency Injection for Java EE (CDI). When approved, it promises to be a key feature of Java EE 6. (November 2, Article)

SAML: It's Not just for Web services

SAML is an XML-based standard for exchanging authentication and authorization data between security domains. The single most important problem that SAML was created to solve is the Web browser Single Sign-On problem. Many organizations are debating whether to stay with version 1.1 or move to 2.0. This article makes observations about both options. (September 28, Article)

Programming is Also Teaching Your Team

Joe Ottinger takes a look at how people learn, and applies it to the practice of programming. He notes that understanding how people learn is an essential part of working in a programming team. (September 22, Article)

Can Java EE Deliver The Asynchronous Web?

Stephen Maryka gave us an article about the Asynchronous Web and posed a number of questions that get examined like an approach to delivering Asynchronous Web capabilities through extensions to existing Java EE technologies. (July 14, Article)

JSF Flex

JavaServer Faces Flex goal is to provide users capability in creating standard Flex components, part of flexSDK which is open sourced through MPL license, as normal JSF components. This article by Ji Hoon Kim will provide an overview of creating a simple multilingual JSF page consisting of JSF Flex tags. (June 29, Article)

The Rules of SOA - A Road to a Successful SOA Implementation

In this session Jeff explores the key characteristics of successful SOA projects. He covers some of the patterns, and anti-patterns, tool sets, and strategies that he himself learned the hard way. Last, he provides a strategy and blueprint for achieving a high likelihood of success in your SOA project. (June 23, Tech Talk)

Ari Zilka Talks About Terracotta 3.1

Ari Zilka, CTO of Terracotta, Inc., talks about the new features in Terracotta 3.1, announced during JavaOne and available now. (June 15, Tech Talk)

Enterprise Application Integration, and Spring

In this Tech Talk, Josh Long explores an integration challenge using Spring Integration and walks through the implementation, employing and expanding on the basic patterns of Enterprise Application Integration to tie together components into a function integration solution, and then demonstrates how Spring Integration helps address the integration requirements. (June 15, Tech Talk)

Google Web Toolkit: An Introduction

In this Tech Talk, David Geary teaches you: The basics of Google Web Toolkit; How to implement Ajax-enabled applications in Java; Internationalization; Hooking into the browser history mechanism; Remote procedure calls. (June 4, Tech Talk)

Just Enough Early Architecture to Guide Development

Jon Kern discusses the best architecture/technical solutions and ensure that they are repeated by all developers. By tackling the architecture up-front in a serial manner, subsequent parallel development will be much more manageable and predictable. (May 28, Tech Talk)

Productive Programmer: On the Lam from the Furniture Police

This keynote describes the frustrations of modern knowledge workers in their quest to actually get some work done, and solutions for how to guard yourself against all those distractions. Neal Ford talks about environments, coding, acceleration, automation, and avoiding repetition as ways to defeat the misguided attempts to sap your ability to produce good work. (May 26, Tech Talk)

Auto-Scaling Your Existing Web Application

Gil demonstrates how new, aggressive uses of already abundant compute capacity by common applications offer competitive value for application designers. (May 21, Tech Talk)

Automating Hibernate Mapping and Queries For Java Web Development

Chris Keene introduces WaveMaker as a new way to automate the ability to generate Hibernate classes in order to more quickly bring OR mapping into an application. (May 19, Article)

Auto-Scaling Your Existing Web Application

In this session Nati Shalom demonstrates how to take a standard Java EE web application and scale it out or down dynamically without changes to the application code. Seeing as most web applications are over-provisioned to meet infrequent peak loads, this is a dramatic change because it enables growing your application as needed, when needed, without paying for unutilized resources. (May 19, Tech Talk)

Free Book: Jakarta-Struts Live

Download the entire book of Jakarta-Struts Live and learn about Struts MVC, Tiles, the Validator, DynaActionForms, plug-ins, internationalization, and more.
(Book PDF Download)

Application Server Matrix

The Application Server Matrix is a detailed listing of J2EE vendors and their application server products, with information on latest version numbers, J2EE spec support and licensing, pricing, platform support, and links to product downloads and reviews.
(Application Server Comparison Matrix)

News | Blogs | Discussions | Tech talks | Patterns | Reviews | White Papers | Downloads | Articles | Media kit | About
Java Solutions
All Content Copyright ©2007 TheServerSide Privacy Policy
Site Map