ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stephan beal <>
Subject Re: Ant design question(s) - #2
Date Mon, 18 Mar 2002 18:29:18 GMT
On Monday 18 March 2002 19:11 pm, John Guthrie wrote:
> I want to have a "help" target that will list out all the possible targets
> in the build.xml. There are three ways I think I could implement it, from
> easiest-and-ugliest getting more elegant (my opinion) but also requiring
> more work. Again, suggestions and opinions are welcome.

See the -projecthelp option of ant:
ant [options] [target [target2 [target3] ...]]
  -projecthelp           print project help information

>   A. just put in a bunch of "echo" tasks stating what I want stated. Makes
> for a big ugly target

with make this is easily solved with a sed script:
        @echo Please use one of these targets:
        @sed -n -e '/^#/d;/ /d;s/^\([a-zA-Z]*.*\):.*/\1/p' < Makefile

With ant it's a bit more work if you wanna customize it. i'd recommend the 
-projecthelp, for consistency with other ant projects.

>   C. write a taskdef that gets an enumeration of all targets in a build.xml
> (I figure that is accessible somewhere in ant), 

>From an Ant task you have full access to the project, tasks, etc. Pretty neat 

----- stephan
Generic Universal Computer Guy -
Office: +49 (89)  552 92 862 Handy:  +49 (179) 211 97 67
"I ain't gen'rally given to physicality of that nature but it saves
a lot of arguing." -- Nanny Ogg

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message