<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
      "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">

<chapter id="packaging">
   <title>Packaging</title>

   <para>We had a brief discussion on the
      <varname>jboss-beans.xml</varname>
      file in
      <xref
            linkend="examples"/>.
      In this chapter, we will go into more depth on the packaging topic. As
      we will see later in
      <xref linkend="standalone"/>
      , the packaging is more of a convention rather
      than a requirement. The convention is recommended since it allows "deployments" to be used both
      standalone and inside JBoss AS.
   </para>

   <para>The basic structure of Microcontainer deployment is a plain
      .jar file (see below). The jar archive
      can also be unpacked in a directory structure that looks
      the jar file. It contains a
      <varname>META-INF/jboss-beans.xml</varname>
      to describe what you
      want it to do. The contents of this xml file are described in
      <xref linkend="basics"/>
      . Finally, the archive contains the classes and any resources just like any other jar file.
   </para>

   <programlisting>
      example.jar/
      example.jar/META-INF/jboss-beans.xml
      example.jar/com/acme/SomeClass.class
   </programlisting>

   <para>If you want to include a .jar file in an
      <varname>.ear</varname>
      deployment, you will need to reference it in
      <varname>META-INF/jboss-app.xml</varname>
      .
   </para>

   <programlisting>
<![CDATA[

   <xml version='1.0' encoding='UTF-8'?>

      <!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>
            <service>example.jar</service>
         </module>

      </jboss-app>

]]>
   </programlisting>

</chapter>
