ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Bullington <shockr...@yahoo.com>
Subject Re: How to provide usage instructions with my targets
Date Tue, 13 Aug 2002 13:41:25 GMT
My way to do it would be to have check targets like the following:

    <target name="check-outdir" unless="outdir">
        <antcall target="instructions" />
        <fail message="outdir not specified.  ex:  -Doutdir=c:\test"/>
    </target>

And then change your target specified below to have:

    <target name="ws.genstubs" description="Generate Axis stubs and
skeletons for specified WSDL file" depends="check-outdir,
check-package, check-wsdl">
        <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>

If you would like more, let me know and I'll try to flesh this out.    



--- Ext-Mike.Hogan@nokia.com wrote:
> 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:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:ant-user-help@jakarta.apache.org>
> 


=====
"Those who live in the shelter of the Most High will find rest in the shadow of the Almighty.
This I declare of the Lord:  He alone is my refuge, my place of safety; he is my God, and
I am trusting himů"

Psalms 91:1-2 (New Living Translation)

__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message