I do something similar in my build scripts.  I use the <condition> tag with
the <isset> nested tag.  Then I use <fail if=""> or <fail unless="">
depending on the situation.

HTH...

Mel Riffe


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 13, 2002 4:20 AM
To: [EMAIL PROTECTED]
Subject: How to provide usage instructions with my targets


Hi,

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}" />
        </java>
    </target>

${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
file>
        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,
Mike.

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
 
**************************************************************************
The information transmitted herewith is sensitive information intended only
for use by the individual or entity to which it is addressed. If the reader
of this message is not the intended recipient, you are hereby notified that
any review, retransmission, dissemination, distribution, copying or other
use of, or taking of any action in reliance upon this information is
strictly prohibited. If you have received this communication in error,
please contact the sender and delete the material from your computer.

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to