You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by mm...@gmx.net on 2001/08/28 13:28:27 UTC

JBoss EJB generation using ANT

Hello,

I am trying to generate my EJBs for JBoss automatically using EJBDoclet and
ANT. 

Right now I have a couple of problems with the generation of the ejb-jar.xml
and also with the deployment of these beans. 

are there any other tools, which can help me there or are there even ready
solutions for this kind of task?

Any help would be greatly appreciated.

regards

Markus M. May
Software Architect

-- 
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net



Re: JBoss EJB generation using ANT

Posted by Mike Williams <mi...@cortexebusiness.com.au>.
  Marcus> I am trying to generate my EJBs for JBoss automatically using
  Marcus> EJBDoclet and ANT.  Right now I have a couple of problems with
  Marcus> the generation of the ejb-jar.xml and also with the deployment of
  Marcus> these beans.

Firstly, you should be aware that EJBDoclet has been renamed as "XDoclet"
(also a sourceforge project), and is effectively no longer supported.  You
may wish to try XDoclet instead.

Having said that, I've got a project that still uses the original version.  
I run EJBDoclet like this:

    <target name="ejb:doclet" 
            depends="ejb:doclet:check,lib:ejbdoclet"
            unless="ejbdoclet.notrequired">
        <mkdir dir="build/ejb/java" />
        <ejbdoclet sourcepath="ejb/java" 
                   mergedir="ejb/java"
                   destdir="build/ejb/java"
                   ejbspec="1.1">
            <fileset refid="ejb:beanFiles" />
            <classpath>
                <path refid="ejbdoclet.classpath" />
                <path refid="ejb:compile.classpath" />
                <pathelement location="build/ejb/classes" />
            </classpath>
            <remoteinterface pattern="{0}"/>
            <homeinterface/>
            <entitypk pattern="{0}Key"/>
            <dataobject/>            
            <entitybmp/>
            <entitycmp/>
            <deploymentdescriptor/>
            <weblogic5/>
            <jboss typemapping="Oracle8" datasource="java:/corshopDataSource"/>
        </ejbdoclet>
    </target>

Note though that ejbdoclet generates generic deployment-descriptor names
like "ejb-jar.xml", and these are not suitable for input into <ejbjar>.  So
I end up renaming these later on ...

    <target name="weblogic6:ejb"
            depends="ejb:compile">
        <!-- Copy deployment-descriptors -->
        <mkdir dir="build/weblogic6/dd" />
        <copy file="build/ejb/java/ejb-jar.xml"
              tofile="build/weblogic6/dd/CorShop-ejb-jar.xml" />
        <copy file="build/ejb/java/weblogic-ejb-jar.xml"
              tofile="build/weblogic6/dd/CorShop-weblogic-ejb-jar.xml" />
        <copy todir="build/weblogic6/dd">
            <fileset dir="build/ejb/java" includes="*CMP.xml" />
        </copy>
        <!-- create CorShop.jar -->
        <ejbjar descriptordir="build/weblogic6/dd" srcdir="build/ejb/classes">
            <support dir="build/ejb/classes" />
            <weblogic destdir="build/weblogic6/app"
                      rebuild="false" 
                      newCMP="true">
                <classpath refid="ejb:classpath" />
                <wlclasspath refid="weblogic6:classpath" />
            </weblogic>
            <dtd publicId="-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN"
                 location="${basedir}/ejb/deploy/ejb-jar-1.1.dtd"/>
            <dtd publicId="-//BEA Systems, Inc.//DTD WebLogic 5.1.0 EJB//EN"
                 location="${basedir}/ejb/deploy/weblogic510-ejb-jar.dtd"/>
            <include name="CorShop-ejb-jar.xml" />
        </ejbjar>
    </target>

Hope this helps.

-- 
cheers, Mike

"Honesty is the key to a relationship. If you can fake that, you're in."
    -- Courtney Cox