0
votes

I'm new to ant and I have to wrap my web project in war file and I'm using ant My project is structured like that:

myproject
--images
--css
--js

and in the war file the final structure is like:

myproject
--css
--images
--js
--META-INF
--WEB-INF

I'd like to change the final structure (to put everything from the project directory in "public" folder) BUT only in the war file, and I'd like to be like that:

myproject
--public
-----css
-----images
-----js
--META-INF
--WEB-INF

I have try using copy task and move task but with no success... What should i do in order to accomplish this?

1
can you show the current script? - Rao
Hi Rao so far it is like this jsfiddle.net/n6n6b8h4 - T1000

1 Answers

1
votes

I think that using prefix attribute in a zipfileset may help you (see zipfileset):

<target name="Wrappin the in war file" description="Compiling....">
    <mkdir dir="${build-directory}" />
    <delete file="${build-directory}/${war-file-name}" />
    <war warfile="${build-directory}/${war-file-name}" webxml="${web-xml-file}">
        <zipfileset dir="${web-directory}" prefix="public">
            <exclude name=".git/**" />
            <exclude name=".svn/**" />
            <exclude name=".idea/**" />
            <exclude name="node_modules/**" />
            <exclude name="bower_components/**" />
        </zipfileset>
        <manifest>
            <attribute name="Built-By" value="${builder}" />
            <attribute name="Built-On" value="${build-info.current-date}" />
            <attribute name="Built-At" value="${build-info.current-time}" />
        </manifest>
    </war>
</target>