Chapter 5. Packaging

We had a brief discussion on the jboss-beans.xml file in Chapter 4, Starting Examples . In this chapter, we will go into more depth on the packaging topic. As we will see later in Chapter 16, 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.

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 META-INF/jboss-beans.xml to describe what you want it to do. The contents of this xml file are described in ??? . Finally, the archive contains the classes and any resources just like any other jar file.

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

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



   <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>