The Artima Developer Community
Sponsored Link

Java Community News
Apache Ant Project Releases 1.7 Beta of Ant

1 reply on 1 page. Most recent reply: Aug 29, 2006 5:22 AM by Steve Loughran

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 1 reply on 1 page
Frank Sommers

Posts: 2642
Nickname: fsommers
Registered: Jan, 2002

Apache Ant Project Releases 1.7 Beta of Ant Posted: Aug 28, 2006 10:43 AM
Reply to this message Reply
Summary
The Apache Ant project released the first beta of the 1.7 version of Ant. The new version introduces a resource framework, as well as antlibs, a framework that makes it easier to create and distribute custom Ant tasks. A new tool for Ant task unit testing is provided as well.
Advertisement

The Apache Ant project released the first beta of Ant 1.7. The new version provides several additions to the capabilities of this popular build tool for Java and .NET.

The first notable new feature is a resource framework:

Some of the core ant tasks such as <copy/> are now able to process not only file system resources but also zip entries, tar entries, paths... Resource collections group resources, and can be further combined with operators such as union and intersection. This can be extended by custom resources and custom tasks using resources.

The second new Ant 1.7 feature is antlib, a new framework of building and packaging Ant tasks. In a recent OnJava article, Ant 1.7: Using Antlibs, Kev Jackson describes antlib as the tool that fixes the deficiencies of the previous taskdef task descriptions:

The antlib feature allows developers of Ant tasks to ship fixes and updates independently of the main Ant distribution... An antlib is simply a collection of classes bundled with an XML descriptor file. Typically, an antlib is distributed as a .jar file, but this isn't a strict requirement. The root element of the XML file is . Any classes can go into the makeup of an antlib, but only some classes can be declared in the antlib.xml file.

Another new Ant 1.7 feature comes in the form of an antlib, AntUnit. This Ant task lets you create unit tests for Ant tasks without having to use the JUnit API.

What are your methods of managing third-party or custom Ant tasks? Do you think that antlib will solve the problem of incrementally updating custom tasks?


Steve Loughran

Posts: 9
Nickname: stevel
Registered: Feb, 2006

Antlibs work for ant1.6.5 Posted: Aug 29, 2006 5:22 AM
Reply to this message Reply
> <p>What are your methods of managing third-party or custom
> Ant tasks? Do you think that <em>antlib</em> will solve
> the problem of incrementally updating custom tasks?</p>

Antlib support has been in ant1.6.5; we have just been refining things for Ant1.7.

By declaring an xmlns for a library, xmns:ac=antlib://net/sf/antcontrib ; ant will autoload the library and make its tasks, types and macros availalable in the new namespace. This does mean that you have to deal with xmlns, but it stops problems with every app server stack providing a task called <deploy>. Now you can have <tomcat:deploy> next to <glassfish:deploy>.

If you are writing third party libraries for ant, write and ship an antlib today, just by adding a new descriptor, antlib.xml. And what is the format of that? Its a subset of ant's own language, with <taskdef>, <typesef>, <presetdef> and <macrodef> being the current set of allowed tasks.

There's one problem with antlibs right now, is that all this automatic stuff works if the new lib dirs are on the classpath. For ant on the command line, you can use the -lib option, or stick stuff in
~/.ant/lib. For IDEs you need to force it on. Otherwise you need to use a typedef command, something like

<typdef uri="antlib://net/sf/antcontrib" classpath="../lib/**/*.jar" />

Incidentally, a new version of Java Development with Ant is due this autumn, in sync with Ant1.7. Expect lots of coverage on antlibs and antunit, which is simply wonderful.

-Steve Loughran
Member of the Ant development team
Author of Java Development with Ant, 2nd edition

Flat View: This topic has 1 reply on 1 page
Topic: Apache Ant Project Releases 1.7 Beta of Ant Previous Topic   Next Topic Topic: Sun Releases JavaDB 10.2 Beta

Sponsored Links



Google
  Web Artima.com   

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