ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject How to provide usage instructions with my targets
Date Tue, 13 Aug 2002 08:20:18 GMT

In short form, my question is, if I have a target that requires parameters on the command
line, how can I print usage instructions if a user fails to supply some or all of the required
parameters.  I would prefer to avoid chaining targets with complimentary if and unless clauses.

In long form, my question is this.  I have the following target:

<target name="ws.genstubs" description="Generate Axis stubs and skeletons for specified
WSDL file">
        <java classname="org.apache.axis.wsdl.WSDL2Java" fork="yes" >
            <classpath refid="project.class.path"/>
            <arg value="-o" />
            <arg value="${outdir}" />
            <arg value="-p" />
            <arg value="${package}" />
            <arg value="${wsdl}" />

${outdir}, ${package} and ${wsdl} are to be supplied by an external actor (and person or another
build.xml file).  If any of there are unset, I would like the following usage message printed:

"usage: ant ws.genstubs -Doutdir=<outdir> -Dpackage=<package> -Dwsdl=<wsdl
	where outdir is the directory the generated stubs will go and
	package is the name of the java package into which to put the code and
	wsdl file is the path to the WSDL file."

I could imagine Ant allowing me to write a target like this:

<target name="ws.genstubs" description="Generate Axis stubs and skeletons for specified
WSDL file" usage="ws.genstubs.usage" required="outdir,package,wsdl">

Then I just define the ws.genstubs.usage target to echo the required message.

Anyway, in the absence of this syntax, ss there any way to do this elegantly using existing
Ant features?

Many thanks,

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

View raw message