views:

807

answers:

1

We're generating Java files from WSDL descripitons using the axis-wsdl2java ant task.

<axis-wsdl2java url="${src.dir.etc}/wsdl/BLAH.wsdl" 
                output="${build.dir.generated_src}" timeout="240000"
                testcase="false" verbose="true" skeletondeploy="false" 
                serverside="false" debug="false" helpergen="false">

Is it possible to include the original WSDL file name or path in the generated Java file as a comment? A comment is already created stating the fact that the file was generated from a WSDL, but it does not say which WSDL file.

UPDATE: To clarify the question, the generated files currently include a comment like this:

/**
 * [FILENAME].java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis [DATE] WSDL2Java emitter.
 */
A: 

I don't think that the this ant task supports doing something like this.

But by using the ReplaceRegExp Task I guess you could do this after the files have been generated. I imagine something like this could work (just a quick write up will need work to get it to work)

<target name="addwsdlnametocomment">
    <replaceregexp match="(WSDL2Java emitter)\.(.*\*/)" flags="sm"  //or only s or only m???
        replace="\1 (${src.dir.etc}/wsdl/BLAH.wsdl)\2">
        <fileset dir="${build.dir.generated_src}">
            <include name="**/*.java"/>
        </fileset>
    </replaceregexp>
</target>
jitter