Completing an EAR (Page 1 of 4 )
In the second of two parts, we focus on deploying the EAR we built in the previous article. This article is excerpted from chapter three of the book
JBoss at Work: A Practical Guide, written by Tom Marrs and Scott Davis (O'Reilly; ISBN: 0596007345). Copyright © 2006 O'Reilly Media, Inc. All rights reserved. Used with permission from the publisher. Available from booksellers or direct from O'Reilly Media.
Ant EAR task
The final step in the process is to EAR up the results of the webapp and common builds. Just as there is a WAR task, Ant also provides us with an EAR task, as in Example 3-4.
Example 3-4. master build.xml
<target name="ear" depends="compile">
<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}" />
</ear>
</target>
Notice that the EAR task requires us to pass it a well-formed application.xml file. Example 3-5 shows what a simple one looks like.
Example 3-5. application.xml
<?xml version="1.0" encoding="UTF-8"?>
<application xmlns=http://java.sun.com/xml/ns/j2ee
xmlns:xsi=http://www.w3.org/ 2001/XMLSchema-instance
xsi:schemaLocation="http:// java.sun.com/xml/ns/j2ee
http://java.sun.com/
xml/ns/j2ee/application_1_4.xsd"
version="1.4">
<display-name>JBossAtWorkEAR</display-name>
<module>
<web>
<web-uri>webapp.war</web-uri>
<context-root>jaw</context-root>
</web>
</module>
<module>
<java>common.jar</java>
</module>
</application>
To verify the results of themasterbuild, change to the build/distribution directory and typejar tvf jaw.ear. You should see webapp.war, common.jar, and application.xml. We are now ready to deploy the EAR file.
Next: Deploying the EAR >>
More Web Authoring Articles
More By O'Reilly Media
|
This article is excerpted from chapter three of the book JBoss at Work: A Practical Guide, written by Tom Marrs and Scott Davis (O'Reilly; ISBN: 0596007345). Check it out today at your favorite bookstore. Buy this book now.
|
|