Ant EJB Tasks User Manual

New JOnAS (Java Open Application Server) element for the current JOnAS version

The <jonas> nested element uses the GenIC-specific tool to build JOnAS-specific stubs and skeletons and construct a JAR file which may be deployed to the JOnAS Application Server. The build process will always determine if the EJB stubs/skeletons and the EJB-JAR file are up to date, and it will perform the minimum amount of work required.

A naming convention for the EJB descriptors is most commonly used to specify the name for the completed JAR file. For example, if the EJB descriptor ejb/Account-ejb-jar.xml is located in the descriptor directory, the <jonas> element will search for a JOnAS-specific EJB descriptor file named ejb/Account-jonas-ejb-jar.xml, and a JAR file named ejb/Account.jar will be written in the destination directory. The <jonas> element can also use the JOnAS naming convention. Using the same example, the EJB descriptor can also be named ejb/Account.xml (no base name terminator here) in the descriptor directory. The <jonas> element will then search for a JOnAS-specific EJB descriptor file called ejb/jonas-Account.xml. This convention does not strictly follow the ejb-jar naming convention recommendation, but it is supported for backward compatibility with previous version of JOnAS.

Note that when the EJB descriptors are added to the JAR file, they are automatically renamed META-INF/ejb-jar.xml and META-INF/jonas-ejb-jar.xml.

Furthermore, this naming behaviour can be modified by specifying attributes in the ejbjar task (for example, basejarname, basenameterminator, and flatdestdir) as well as the iplanet element (for example, suffix). Refer to the appropriate documentation for more details.

Parameters:

Attribute Description Required
destdir The base directory into which the generated JAR files will be written. Each JAR file is written in directories which correspond to their location within the "descriptordir" namespace. Yes
jonasroot The root directory for JOnAS. Yes
jonasbase The base directory for JOnAS. If omitted, it defaults to jonasroot. No
classpath The classpath used when generating EJB stubs and skeletons. If omitted, the classpath specified in the "ejbjar" parent task will be used. If specified, the classpath elements will be prefixed to the classpath specified in the parent "ejbjar" task. A nested "classpath" elements can also be used. Note that the needed JOnAS JAR files are automatically added to the classpath. No
keepgenerated true if the intermediate Java source files generated by GenIC must not be deleted. If omitted, it defaults to false. No
nocompil true if the generated source files must not be compiled via the java and rmi compilers. If omitted, it defaults to false. No
novalidation true if the XML deployment descriptors must be parsed without validation. If omitted, it defaults to false. No
javac Java compiler to use. If omitted, it defaults to the value of build.compiler property. No
javacopts Options to pass to the java compiler. No
protocols Comma-separated list of protocols (chosen within jeremie, jrmp, iiop, cmi) for which stubs should be generated. Default is jrmp,jeremie. No
rmicopts Options to pass to the rmi compiler. No
verbose Indicates whether or not to use -verbose switch. If omitted, it defaults to false. No
additionalargs Add additional args to GenIC. No
keepgeneric true if the generic JAR file used as input to GenIC must be retained. If omitted, it defaults to false. No
suffix String value appended to the JAR filename when creating each JAR. If omitted, it defaults to ".jar". No
nogenic If this attribute is set to true, JOnAS's GenIC will not be run on the EJB JAR. Use this if you prefer to run GenIC at deployment time. If omitted, it defaults to false. No
mappernames List of JORM mapper names, separated by comma, used for CMP2.0 to indicate for which mappers the container classes should be generated. No
jvmopts Additional args to pass to the GenIC JVM. No

As noted above, the jonas element supports additional <classpath> nested elements.

Examples

This example shows ejbjar being used to generate deployment jars using a JOnAS EJB container. This example requires the naming standard to be used for the deployment descriptors. Using this format creates a EJB JAR file for each variation of  '*-jar.xml' that is located in the deployment descriptor directory. 

      <ejbjar srcdir="${build.classes}"
              descriptordir="${descriptor.dir}">
        <jonas destdir="${deploymentjars.dir}"
               jonasroot="${jonas.root}"
               protocols="jrmp,iiop"/>
        <include name="**/*.xml"/>
        <exclude name="**/jonas-*.xml"/>
        <support dir="${build.classes}">
             <include name="**/*.class"/>
        </support>
      </ejbjar>

This example shows ejbjar being used to generate a single deployment jar using a JOnAS EJB container. This example does require the deployment descriptors to use the naming standard. This creates only one ejb jar file - 'TheEJBJar.jar'.

      <ejbjar srcdir="${build.classes}"
              descriptordir="${descriptor.dir}"
              basejarname="TheEJBJar">
        <jonas destdir="${deploymentjars.dir}"
               jonasroot="${jonas.root}"
               suffix=".jar"
               protocols="${genic.protocols}"/>
        <include name="**/ejb-jar.xml"/>
        <exclude name="**/jonas-ejb-jar.xml"/>
      </ejbjar>