Section 5.5. Adding the HAR to the EAR


5.5. Adding the HAR to the EAR

Moving up a level from the common subproject to the master project, we need to make sure that the EAR file includes our newly created HAR. The master build file already handles this step, since the jaw.har file is built in the same directory as common.jar. (Look in common/build/distribution to confirm this.)

But what about our application.xml file? This is traditionally where we identify the JARs that are included in the EAR. HARs are not a standard part of a J2EE EAR file, so JBoss looks for a jboss-app.xml file to handle container-specific exceptions to the standard. src/META-INF/ stores this file, right next to your application.xml file. Example 5-6 shows what it looks like.

Example 5-6. jboss-app.xml
 <!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD J2EE Application 1.4//EN"            "http://www.jboss.org/j2ee/dtd/jboss-app_4_0.dtd"> <jboss-app>   <module>     <har>jaw.har</har>   </module> </jboss-app> 

Our <ear> task now includes this file along with the traditional application.xml in Example 5-7.

Example 5-7. Master build.xml
 <!-- ====================================== -->     <target name="ear" depends="compile"             description="Packages all files into an EAR file">         <mkdir dir="${build.dir}" />         <mkdir dir="${distribution.dir}" />         <echo message="##### Building EAR #####" />         <ear destFile="${distribution.dir}/${ear.name}"              appxml="${meta-inf.dir}/application.xml" >             <!-- files to be included in / -->             <fileset dir="${webapp.war.dir}" />             <fileset dir="${common.jar.dir}" />             <!-- include jboss-app.xml -->             <metainf dir="${meta-inf.dir}">                 <include name="jboss-app.xml"/>             </metainf>         </ear>     </target> 



JBoss at Work. A Practical Guide
JBoss at Work: A Practical Guide
ISBN: 0596007345
EAN: 2147483647
Year: 2004
Pages: 197

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net