Search code examples
javajakarta-eeantear

How do I use ant dirset with the ear task?


I'm building an EAR with ant which needs to include the lib folder (including jars) from my EAR project. I've tried this but although a lib folder is created in the ear file no jars are included. Only the war files are copied into the ear.

<ear destfile="${ear.file}" appxml="META-INF/application.xml">
    <dirset dir=".">
        <include name="lib" />
    </dirset>

    <fileset dir="${temp.dir}">
        <include name="*.war" />
    </fileset>
</ear>

Solution

  • I used the zipfileset task instead, which does the trick:

    <ear destfile="${ear.file}" appxml="META-INF/application.xml">
        <zipfileset dir="lib" prefix="lib"/>
    
        <fileset dir="${temp.dir}">
            <include name="*.war" />
        </fileset>
    </ear>