2
votes

I'm building an ear file using ANT build.xml and need to include .java files in my ear package created. Any pointers?

Below is the war section from my build.xml

    <target name="war" depends="compile">
        <war destfile="${dist}/${ant.project.name}.war" webxml="${warbasepath}/WebContent/WEB-INF/web.xml">
          <lib dir="${lib}" />
          <classes dir="${build}"/>
          <fileset dir="${warbasepath}/WebContent" excludes="**/*.class **/*.jar" /> 
        </war>
    </target>
1
you never include the extra content. - Tim Biegeleisen
@Vivek Why would you want to include the source code in your executable? Sourcecode can be bundled separately. - Chetan Kinger

1 Answers

1
votes

Take a look at the EAR task manual. It is just an extension of the JAR task, so you can include whatever you like. ​

You can include arbitrary filesets:

<ear destfile="${build.dir}/myapp.ear" appxml="${src.dir}/metadata/application.xml">
    <fileset dir="${build.dir}" includes="*.jar,*.war"/>
    <fileset dir="${src.dir}" includes="**/*.java"/>
</ear>

However an EAR should be just a container for wars and ejb jars, so you probably should add your source code rather in those.