The Artima Developer Community
Sponsored Link

Java Buzz Forum
Breaking Version Inertia: Ant: import and macrodef

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Weiqi Gao

Posts: 1808
Nickname: weiqigao
Registered: Jun, 2003

Weiqi Gao is a Java programmer.
Breaking Version Inertia: Ant: import and macrodef Posted: Apr 14, 2008 11:51 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Weiqi Gao.
Original Post: Breaking Version Inertia: Ant: import and macrodef
Feed Title: Weiqi Gao's Weblog
Feed URL: http://www.weiqigao.com/blog/rss.xml
Feed Description: Sharing My Experience...
Latest Java Buzz Posts
Latest Java Buzz Posts by Weiqi Gao
Latest Posts From Weiqi Gao's Weblog

Advertisement

I've been using Ant since the very early days. ("Tomcat is built with Ant. What is Ant?" Remember those days?) Since my use of ant does not usually involve anything esoteric, I have fallen victim to version inertia. Ant 1.4, 1.5, 1.6, 1.7 came out over the years, and I didn't much glance at the release notes.

Meanwhile, some of my build.xml files has grown organically. Since the code is modularized with a nice "B depends on A, C depends on B, etc..." structure, the build.xml reflects that with targets like "compile-A", "compile-A-test", "run-A-test", "compile-B", "compile-B-test", "run-B-test", ..., each with their own classpath definition.

And as we added modules, we copy and pasted big chunks of Ant code, bloating the build file.

This become unbearable recently. And I looked for ways to make the build file manageable again. That's when I found the two new features of Ant: import and macrodef. Both are available in the latest Ant 1.7.0 release.

I won't bore you with the details of how these two tasks work. But it did allow me to break my build file into a

template-build.xml
which contains a set of macro definitions, and a bunch of
A-build.xml
B-build.xml
...
files each importing template-build.xml and instantiate the set of targets for a module. The build.xml then imports all the A-build.xml, ... files and use all the targets in a systematical way.

If you are using Ant, import and macrodef are your friends, just like if you are using C, #import and #define are your friends.

Read: Breaking Version Inertia: Ant: import and macrodef

Topic: How’s your T-Zone? - IBM Impact from PeopleOverProcess.com Previous Topic   Next Topic Topic: Toasters! Blenders! Micro-waves! OH YEAH! - IBM Impact from PeopleOverProcess.com

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use