views:

93

answers:

1

I have error at the first line of the following code while building with Ant builder,

<war warfile="${wartemp.dir}/${name}.war" basedir="${wartemp.dir}" webxml="${wartemp.dir}/WEB-INF/web.xml">
            <include name="*"/>
            <include name="scripts/**"/>
            <include name="styles/**"/>
            <include name="images/**"/>
            <include name="WEB-INF/*.*"/>
            <include name="WEB-INF/lib/**"/>
            <include name="WEB-INF/views/**"/>
            <include name="WEB-INF/classes/**"/>
            <include name="WEB-INF/jsp/**"/>
            <include name="WEB-INF/resources/**"/>
            <include name="WEB-INF/spring/**"/>
            <include name="WEB-INF/messages/**"/>
            <include name="WEB-INF/layouts/**"/>
            <exclude name="WEB-INF/web.xml"/>           
            <exclude name="**/.*"/>
        </war>

The error message is:

"... /WEB-INF/build.xml:67: A zip file cannot include itself" line 67 is the first line of the snippet posted above.

I am beginner to Spring framework. I am using Spring version 3 with springsource toolsuite. How to fix this? thanks.

+1  A: 

Your basedir is the same dir as where you are sending the outputted war file. This is not a problem in itself, the problem is you are including * as input which will include the output file.

To fix this you could either exclude the output file from the included files, e.g.:

<exclude name="${name}.war"/>

or you could write the war file to a different directory structure than you are reading from, e.g.:

<mkdir dir="${war.output.dir}" />
<war warfile="${war.output.dir}/${name}.war" ...>
krock
An '=' missing in your first snippet.
pMan
thanks @pMan, fixed.
krock