[Ant] How to factorize tasks? (Newbie-question)

From: contrex (QTRAURFUICIN_at_spammotel.com)
Date: 02/17/04


Date: 17 Feb 2004 08:47:40 -0800

I want to factorize two ant targets (deploy/undeploy). The only
difference is that they call a java class with a different parameter
(a wsdd file). Here is a snippet of the working ant build.xml file:

<project name="MyProject" default="compile" basedir=".">
        ...
        <path id="project.adminclient.classpath">
              ...
        </path>

        
        <target name="deploy">
                <java classname="org.apache.axis.client.AdminClient">
                        <arg value="A"/>
                        <arg value="B"/>
                        <arg value="deploy.wsdd"/>
                        <classpath refid="project.adminclient.classpath" />
                </java>
        </target>
  
        <target name="undeploy">
                <java classname="org.apache.axis.client.AdminClient">
                        <arg value="A"/>
                        <arg value="B"/>
                        <arg value="undeploy.wsdd"/>
                        <classpath refid="project.adminclient.classpath" />
                </java>
        </target>
        
</project>

I thought I could facorize the <java> tag to something like:

<project name="MyProject" default="compile" basedir=".">
        ...
        <path id="project.adminclient.classpath">
              ...
        </path>
        
        <java id="project.adminclient.execute"
classname="org.apache.axis.client.AdminClient">
                        <arg value="A"/>
                        <arg value="B"/>
                        <classpath refid="project.adminclient.classpath" />
        </java>

        
        <target name="deploy">
                <java refid="project.adminclient.execute">
                        <arg value="deploy.wsdd"/>
                </java>
        </target>
  
        <target name="undeploy">
                <java refid="project.adminclient.execute">
                        <arg value="undeploy.wsdd"/>
                </java>
        </target>
        
</project>

The call of the <java> tag works but the problem is that the parameter
(wsdd-file) isn't passed to the <java> tag.

Can you say me how one would do this?

Thank you very much!



Relevant Pages

  • Re: java app in webbrowser control
    ... try converting the HTML to use the tag instead. ... the image does render in IE and there is no activex installation ... >I recognize that this question has a substantial Java component and I>have ... > I can also fill a webbrowser control with the image: ...
    (microsoft.public.dotnet.languages.csharp)
  • Code review requested
    ... I am starting out in Java. ... the form of a stream. ... for the sake of inserting one tag. ... What about Unicode? ...
    (comp.lang.java.programmer)
  • RE: no inputstream?
    ... I'm curious as to how Java manages this. ... Anyway, as I see it, this is more of a HTTP protocol question. ... whatever id3 tag reading library you're using. ... it should only download the part of the file it needs (which if the ...
    (comp.lang.python)
  • Re: Hard coding HTML into JSP tag handler
    ... I'm using JSP 2.0 tag libraries but my struggle is with what appears to ... With a .tag file I have to put a bunch of Java code into the view. ... a tag handler class I have to out.println a bunch of html from my java. ...
    (comp.lang.java.programmer)
  • Code review
    ... I am starting out in Java. ... the form of a stream. ... for the sake of inserting one tag. ... * Search the byte stream for the end of the second tag. ...
    (comp.lang.java.developer)