You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Keith Hatton <kh...@axiomsystems.com> on 2006/01/24 11:35:16 UTC

Using mapper to rename files included in WAR

I'm using Ant 1.6.2 and I need to include deployment descriptor files in
the WEB-INF section of my WAR file. However I need to rename them when I
include them so that, for example, console-weblogic.xml becomes
weblogic.xml and console-orion-web.xml becomes orion-web.xml.

I skimmed the section on mappers and hoped that the following (this is
in a <macrodef>) would work:

<war destfile="..." webxml="...">
    ...
    <webinf dir="${descriptors}/@{appserver}/web">
        <mapper type="glob" from="console-*.xm*" to="*.xm*"/>
        <include name="console-*.xm*"/>
    </webinf>
</war>

I get the following error:
    The <zipfileset> type doesn't support the nested "mapper" element.

So obviously I am doing something wrong. The manual section on mappers
doesn't really give me enough context to see what I should be doing
instead - any suggestions?

Thanks
Keith

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


Re: Using mapper to rename files included in WAR

Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 24 Jan 2006, Keith Hatton <kh...@axiomsystems.com> wrote:

> I skimmed the section on mappers and hoped that the following (this
> is in a <macrodef>) would work:
> 
> <war destfile="..." webxml="...">
>     ...
>     <webinf dir="${descriptors}/@{appserver}/web">
>         <mapper type="glob" from="console-*.xm*" to="*.xm*"/>
>         <include name="console-*.xm*"/>
>     </webinf>
> </war>

Neither <zip> (or its child <war>) nor <zipfileset> (of which <webinf>
is a variant) support mappers.  In order to achieve what you want to
do, you must create a temporary copy of your files using a mapper and
zip up that copy with <webinf>.

Stefan

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