1

Pretty new to this so bear with me. I've gotten my Ant build.xml to run and populate everything that I want, but my content (js, css, jsp, etc) is just jammed into the WAR at its topmost directory. I'm looking to put this content into the WEB-INF folder that I would need to make within the war. Here's what I have so far as a reference. If I could just see an example of how to do this I think I would be good. Tried to follow this thread, is that dist setup what I am missing??

    <war warfile="${build}/${project.name}.war" webxml="${appconf}/web.xml">
        <classes dir="${appconf}/classes" />
        <fileset dir="${appcontent}" includes="jsp/**,js/**,images/**,css/**,tg/**" excludes="**/*.~js,**/*.~jav,**/*.java,cvs,annotation">
            <patternset id="jsp_images_package">
                <include name="**/*.jsp,**/*.js,**/*.gif,**/*.html,**/*.css"/>
                <exclude name="**/*.~js,**/*.~jav"/>
            </patternset>
        </fileset>
        <fileset dir="${appcontent}" includes="WEB-INF/lib/*.jar,WEB-INF/*.jar"/>
        <fileset dir="${appcontent}" includes="WEB-INF/lib/*.css"/>
        <fileset dir="${appcontent}" includes="docs/*.doc"/>
    </war>
Community
  • 1
  • 1
B.Z.B
  • 471
  • 2
  • 10
  • 24

1 Answers1

0

What you want to use in this case is <zipfileset>. It should look something like this (Your structure is weird, so I can't tell exactly where you want files).

<war warfile="${build}/${project.name}.war" webxml="${appconf}/web.xml">
    <classes dir="${appconf}/classes" />
    <zipfileset dir="${appcontent}/jsp" includes="**/*.jsp" prefix="WEB-INF"/>
    <zipfileset dir="${appcontent}/js" includes="**/*.js" prefix="WEB-INF"/>
    <zipfileset dir="${appcontent}/css" includes="**/*.css" prefix="WEB-INF"/>
    <fileset dir="${appcontent}">
        <include name="docs/*.doc"/>
        <include name="images/**"/>
        <include name="WEB-INF/*.jar"/>
        <include name="WEB-INF/lib/*.jar"/>
        <include name="WEB-INF/lib/*.css"/>
    </fileset>
</war>
JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
  • eh dont worry about the struct, this is great. So from the looks of it what I was missing is that prefix command. So that will put it in the correct folder for me. – B.Z.B Apr 05 '11 at 20:55
  • Have any good links that explain how to do this correctly? I couldn't find a good API/explanation on this for the life of me. – B.Z.B Apr 05 '11 at 20:57
  • Don't worry, I have a hard time finding out what Ant can do myself. So the prefix will add that folder path to the relative paths of the files specified in "includes." – JasonMArcher Apr 05 '11 at 23:16