ANT script question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • astroboiii
    New Member
    • Mar 2008
    • 2

    ANT script question

    Having a little issue with my build script.

    I have some EAR files that I extract WAR files from, I then extract .wsdl files from the WAR files and do some work with those wsdl files.

    However, the work I do for the wsdl files needs to include the name of the ear file it's come from. But I'm not exactly sure how to do that since they are done in separate methods.

    I have a method which extracts the EAR's and then extracts the WAR's.
    I have a separate method which does the work needed to be done on the wsdl files.

    The wsdl's are in a directory structure such as this: EAR_FILE_IT_HAS _COME_FROM\xyz\ ...\*.wsdl

    is there any way I can get the parent directory from the structure I just posted? (the "EAR_FILE_IT_HA S_COME_FROM" directory that is to say).

    That is what I need to append to each wsdl file.

    here are teh two methods which do the jobs I have described.

    <!-- Creates an xml file for each wsdl file -->
    <macrodef name="xlstTrans form">
    <attribute name="root.dir" default="${base dir}/make/target" />
    <attribute name="style.fil e" default="${base dir}/make/xml/xslt/WSDLStyle.xslt" />

    <sequential>
    <for param="wsdlPath ">
    <path>
    <fileset dir="@{root.dir }" includes="**/*.wsdl" />
    </path>
    <sequential>
    <var name="temp.file " unset="true" />
    <basename property="temp. file" file="@{wsdlPat h}" />
    <xslt style="@{style. file}" in="@{wsdlPath} " out="${basedir}/make/target/xml/${temp.file}.xm l" force="true">
    <param name="earFile" expression="ear File" />
    </xslt>
    </sequential>
    </for>
    </sequential>
    </macrodef>

    <!--
    This target extracts all ear files and then extracts all war files within the expanded ear file dir's
    -->
    <target name="extract" depends="info">
    <for param="earPath" >
    <path>
    <fileset dir="${basedir}/make/lib/ears" includes="**/*.ear" />
    </path>
    <sequential>
    <var name="earFile" unset="true" />
    <basename property="earFi le" file="@{earPath }" />
    <unzip src="@{earPath} " dest="${basedir }/make/target/extracted/${earFile}" />
    <for param="warPath" >
    <path>
    <fileset dir="${basedir}/make/target/extracted/${earFile}" includes="**/*.war" />
    </path>
    <sequential>
    <var name="warFile" unset="true" />
    <basename property="warFi le" file="@{warPath }" />
    <unwar src="@{warPath} " dest="${basedir }/make/target/extracted/${earFile}/WAR/" />
    </sequential>
    </for>
    </sequential>
    </for>
    </target>
Working...