Double check your setting of bindingarg:

<condition property="binding.arg" value='-b "@{bindingfile}"'>
    <not>
        <equals arg1="@{bindingfile}" arg2=""/>
    </not>
</condition>

<property name="binding.arg" value=""/>


For your first run, you set the property bingding.arg to:
   -b "@{bindingfile}"

Of course assuming binding.arg wasn't already set ;)

For your second run, you cannot reset binding.arg - regardless... If you need to reset the property you may need to look to Ant Contrib or do something different...

Basically, it gets set correctly the first time but not the second...

If you put an <echo message="bindingfile = @{bindingfile}"> right after your <sequential> element - I think you will see the attribute is set correctly in your macrodef... Its just how you are using the property internal to your macrodef...

Stock Ant you cannot reset a property once you set it :)






On Tue, 28 Jul 2009, edumudi.viswan...@oracle.com wrote:

Further to below mail, I found that it failing @ the following code in macrodef.

<java failonerror="true" classname="org.apache.cxf.tools.wsdlto.WSDLToJava" 
fork="yes">
               <classpath>
                   <path refid="cxfClassPath" />
               </classpath>
               <sysproperty key="java.util.logging.config.file" 
value="${cxf.etc.dir}/logging.properties"/>
               <sysproperty key="exitOnFinish" value="true"/>
               <arg line="@{servicename.arg}"/>
               <arg line="${package.a...@{file}}"/>
               <arg line="${binding.arg}"/>
                               <arg line="${exsh.arg}"/>
               <arg value="-verbose"/>
               <arg value="-d"/>
               <arg value="@{srcdestdir}"/>
               <arg value="@{dir}/@{file}"/>
           </java>

-----Original Message-----
From: edumudi.viswan...@oracle.com [mailto:edumudi.viswan...@oracle.com]
Sent: Tuesday, July 28, 2009 8:16 PM
To: Ant Users List
Subject: RE: problem with macrodef in ant


Below I proded the exception related information. I used the same code which I 
provided to you. Please check it.

generate.service:
    [echo] Generating code using wsdl2java...
    [java] Loading FrontEnd jaxws ...
    [java] Loading DataBinding jaxb ...
    [java] wsdl2java -b ../root-dir/bindingfile1.xml -exsh true -verbose -d 
C:\xyz\yzx\root-dir/src C:\xyz\yzx\root-dir/wsdl/wsdlfile1.wsdl
    [java] wsdl2java - Apache CXF 2.1.5


generate.service1:
    [echo] Generating code using wsdl2java...
    [java] Loading FrontEnd jaxws ...
    [java] Loading DataBinding jaxb ...
    [java] wsdl2java -b ../root-dir/bindingfile1.xml -exsh true -verbose -d 
C:\xyz\yzx\root-dir/src C:\xyz\yzx\root-dir/wsdl/wsdlfile2.wsdl
    [java] wsdl2java - Apache CXF 2.1.5


    [java] WSDLToJava Error: Thrown by JAXB :  
"file:/C:\xyz\yzx\root-dir/wsdl/wsdlfile1.xsd is not a part of this compilation. Is this 
a mistake for  "file:/C:\xyz\yzx\root-dir/wsdl/wsdlfile2.xsd"?

    [java] org.apache.cxf.tools.common.ToolException: Thrown by JAXB : 
"file:/C:\xyz\yzx\root-dir/wsdl/wsdlfile1.xsd  is not a part of this compilation. Is this 
a mistake for "file:/C:\xyz\yzx\root-dir/wsdl/wsdlfile2.xsd"?
    [java]     at 
org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBBindErrorListener.error(JAXBBind
ErrorListener.java:34)
    [java]     at 
com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.error(SchemaCompilerImpl.java:2
85)
    [java]     at 
com.sun.tools.xjc.reader.internalizer.Internalizer.reportError(Internalizer.java:
504)
    [java]     at 
com.sun.tools.xjc.reader.internalizer.Internalizer.reportError(Internalizer.java:
495)
    [java]     at 
com.sun.tools.xjc.reader.internalizer.Internalizer.buildTargetNodeMap(Internalize
r.java:205)
    [java]     at 
com.sun.tools.xjc.reader.internalizer.Internalizer.buildTargetNodeMap(Internalize
r.java:289)
    [java]     at 
com.sun.tools.xjc.reader.internalizer.Internalizer.transform(Internalizer.java:13
4)
    [java]     at 
com.sun.tools.xjc.reader.internalizer.Internalizer.transform(Internalizer.java:96
)
    [java]     at 
com.sun.tools.xjc.reader.internalizer.DOMForest.transform(DOMForest.java:448)
    [java]     at 
com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:22
1)
    [java]     at 
com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:85
)
    [java]     at 
org.apache.cxf.tools.wsdlto.databinding.jaxb.JAXBDataBinding.initialize(JAXBDataB
inding.java:218)
    [java]     at 
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.generateTypes(WSDLToJavaContainer
.java:577)
    [java]     at 
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.processWsdl(WSDLToJavaContainer.j
ava:228)
    [java]     at 
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:
130)
    [java]     at 
org.apache.cxf.tools.wsdlto.WSDLToJavaContainer.execute(WSDLToJavaContainer.java:
272)
    [java]     at 
org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:83)
    [java]     at 
org.apache.cxf.tools.wsdlto.WSDLToJava.run(WSDLToJava.java:103)
    [java]     at 
org.apache.cxf.tools.wsdlto.WSDLToJava.main(WSDLToJava.java:173)
    [java] Caused by: com.sun.istack.SAXParseException2: 
"file:/C:\xyz\yzx\root-dir/wsdl/wsdlfile1.xsd  is not a part of this compilation. Is this 
a mistake for "file:/C:\xyz\yzx\root-dir/wsdl/wsdlfile2.xsd"?
    [java]     at 
com.sun.tools.xjc.reader.internalizer.Internalizer.reportError(Internalizer.java:


-----Original Message-----
From: Scot P. Floess [mailto:sflo...@nc.rr.com]
Sent: Tuesday, July 28, 2009 7:39 PM
To: Ant Users List
Subject: Re: problem with macrodef in ant


I tried your example but cutting down on everything in wsdl2java - meaning
just used some <echo> statements...

It worked fine for me:

ant generate.service generate.service1

Buildfile: build.xml

generate.service:
     [echo] file        [wsdlfile1]
     [echo] bindingfile [buildingfile1]

generate.service1:
     [echo] file        [wsdlfile2]
     [echo] bindingfile [buildingfile2]


Here is the build.xml I used:

<project>
    <macrodef name="wsdl2java">
        <attribute name="srcdestdir" default="${pojoSourceDir}"/>
<attribute name="destdir" default="${buildDir}"/>
        <attribute name="file"/>
<attribute name="servicename.arg" default=""/>
        <attribute name="bindingfile" />
<attribute name="exshvalue" default="true"/>
        <attribute name="dir" default="${wsdlDir}"/>
<attribute name="package" default="NOT_SPECIFIED"/>
        <sequential>
<echo  message = "file        [...@{file}]"/>
            <echo  message = "bindingfile [...@{bindingfile}]"/>
        </sequential>
    </macrodef>

    <target name="generate.service">
        <wsdl2java file="wsdlfile1" bindingfile="buildingfile1" />
</target>

    <target name="generate.service1">
        <wsdl2java file="wsdlfile2" bindingfile="buildingfile2" />
    </target>
</project>



On Tue, 28 Jul 2009, edumudi.viswan...@oracle.com wrote:

Hi Friends,

I have macrodef in build.xml & it took parameters like wsdlfile & bindingfile from wsdl2java tag ie 
<wsdl2java file="wsdlfile1" bindingfile="bindingfile1" />.

Now, If I run macrodef with wsdlfile1 & bindingfile1, It works asusually.

But if I run same macrodef again with wsdlfile2 & bindingfile2, In that case it 
taking previous bindingfile1 instead of new given buildingfile2.

Below I provided macrodef & I am calling macrodef with target name=" generate.service" 
and target name=" generate.service1" respectively.


1)      <macrodef name="wsdl2java">
       <attribute name="srcdestdir" default="${pojoSourceDir}"/>
       <attribute name="destdir" default="${buildDir}"/>
       <attribute name="file"/>
       <attribute name="servicename.arg" default=""/>
       <attribute name="bindingfile" />
               <attribute name="exshvalue" default="true"/>
       <attribute name="dir" default="${wsdlDir}"/>
       <attribute name="package" default="NOT_SPECIFIED"/>
       <sequential>
           <mkdir dir="@{destdir}"/>
           <mkdir dir="@{srcdestdir}"/>

           <condition property="package.a...@{file}" value="-p @{package}">
               <not>
                   <equals arg1="@{package}" arg2="NOT_SPECIFIED"/>
               </not>
           </condition>
           <property name="package.a...@{file}" value=""/>

                       <condition property="binding.arg" value='-b 
"@{bindingfile}"'>
                               <not>
                                   <equals arg1="@{bindingfile}" arg2=""/>
                               </not>
                           </condition>
                           <property name="binding.arg" value=""/>

                       <condition property="exsh.arg" value='-exsh  
"@{exshvalue}"'>
                       <not>
                           <equals arg1="@{exshvalue}" arg2=""/>
                       </not>
                       </condition>
                       <property name="exsh.arg" value=""/>

           <java failonerror="true" classname="org.apache.cxf.tools.wsdlto.WSDLToJava" 
fork="yes">
               <classpath>
                   <path refid="cxfClassPath" />
               </classpath>
               <sysproperty key="java.util.logging.config.file" 
value="${cxf.etc.dir}/logging.properties"/>
               <sysproperty key="exitOnFinish" value="true"/>
               <arg line="@{servicename.arg}"/>
               <arg line="${package.a...@{file}}"/>
               <arg line="${binding.arg}"/>
                               <arg line="${exsh.arg}"/>
               <arg value="-verbose"/>
               <arg value="-d"/>
               <arg value="@{srcdestdir}"/>
               <arg value="@{dir}/@{file}"/>
           </java>
       </sequential>
   </macrodef>


2)       <target name="generate.service" depends="generate.esfconfig">
       <wsdl2java file="wsdlfile1" bindingfile="buildingfile1" />
       </target>

3)      <target name="generate.service1" depends="generate.esfconfig">
       <wsdl2java file="wsdlfile2" bindingfile="buildingfile2" />
          </target>

Please help me to solve this issue.

Thanks & Regards,
vishy


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org



Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-890-8117 (Work)

Chief Architect JPlate   http://sourceforge.net/projects/jplate
Chief Architect JavaPIM  http://sourceforge.net/projects/javapim

Architect Keros          http://sourceforge.net/projects/keros

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org



Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-890-8117 (Work)

Chief Architect JPlate   http://sourceforge.net/projects/jplate
Chief Architect JavaPIM  http://sourceforge.net/projects/javapim

Architect Keros          http://sourceforge.net/projects/keros

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to