When developing EJBs, you have a multitude of changes to the bean class that affect the final deployment descriptor of the bean. Even if you generate the deployment descriptor once, you may have to change it each time you alter a bean class, interface, or persistent feature etc.

Generating the deployment XML is only part of an important task. XDoclet will help you maintain this file by updating it as your beans change and develop. To have XDoclet generate your deployment descriptor, add the 'deploymentdescriptor' subtask to your 'ejbdoclet' task in the build.xml file. The 'ejbdoclet' task shown in the sample below uses the 'deploymentdescriptor' subtask:

An Ant file fragment:

<target name="ejbdoclet" depends="init">

	<ejbdoclet destdir="${src}" ejbspec="2.0" >
		 destdir="${build}/ejb/META-INF" />



XDoclet declarations in EJB code:

 * @ejb.bean type="Stateful"
 *     name="UserBean"
 *     jndi-name="ejb/UserBean"
 *     local-jndi-name="ejb/UserBeanLocal"
 *     view-type="both"
public class SampleBean implements SessionBean {