U don't need to build ear every time to test application
 
In your application.xml write
 
   <module>
      <web>
         <web-uri>SOME_DIR-web</web-uri>
         <context-root>/</context-root>
      </web>
   </module>
so you will get:
 
APPLICATION-DIR/
  META-INF/
     Application.xml
  SOME_DIR-web/
  your_ejb_here
 
I use Ant for ejb building, but ANT have a bug in ejbjar task
i've made a little patch to "Ant.src/src/main/org/apache/tools/ant/taskdefs/optional/ejb/DescriptorHandler.java "
 
            if (!className.startsWith("java.lang")) {
                // Translate periods into path separators, add .class to the
                // name, create the File object and add it to the Hashtable.
// Parf's patch here
//                className = className.replace('.', File.separatorChar);
                className = className.replace('.', '/');

                className += ".class";
 
So your build.xml will look like this one:
 
  <target name="mkbn" depends="library">
     <ejbjar descriptordir="${src}"
              srcdir="${build}"
              destdir="${ejb}"
              basenameterminator="."
              genericjarsuffix=".jar"
              flatdestdir="true"
              >
       <include name="**/*.ejb-jar.xml"/>
     </ejbjar>
     <antcall target="app"/>
 </target>
  <target name="app" description="Rebuild Application.xml" >
    <exec dir="${src}/JG" executable="perl">
       <arg value="Make_Application_Xml.pl"/>
    </exec>
  </target>
Make_Application_Xml.pl - simple perl script for auto generating Application.xml:
my $jars;
for(`ls /e-mall/*.jar`) {
 s/.*\///; chomp; $jars.="  <module><ejb>$_</ejb></module>\n" ;
}
open F,">/e-mall/META-INF/application.xml";
print F <<EOF;
<?xml version="1.0"?>
<!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN" "
http://java.sun.com/j2ee/dtds/application_1_2.dtd">
<application>
   <display-name>Axwell Portal</display-name>
$jars
   <module>
      <web>
         <web-uri>e-mall-web</web-uri>
         <context-root>/</context-root>
      </web>
   </module>
</application>
EOF
close F;
Ant will search for all *.ejb-jar.xml's and make them (only home,remote & bean libs)
To include other files make a application side library:
something like this:
  <target name="mall-ejblib" depends="ejblib_init" >
    <jar jarfile="${ejb}/ejblib-mall.jar" basedir="${build}">
       <include name="META-INF/ejb-jar.xml" />
       <!-- lookup -->
       <include name="unipoint/ejb/lookup/AlexEJBLookup.class" />
         ......
    </jar>
  </target>
 
Btw there is another bug in Parser.jar that comes with Ant,
when it locates string like this in xml declaration it tryes to get dtd from given location
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>
I've decompiled and patched this too. - Speed increase more than 20x.
 
Now it takes only 5 sec for me to compile, build and install any beans/servlets with orion & Ant.
 
BTW: if u like to build a ear add a simple jar task for war and jar task for ejb library
 
----- Original Message -----
From: faisal
Sent: Saturday, February 10, 2001 5:47 AM
Subject: One Build.xml

Hi Guys
Has any of Orion gurus found a way to use tha same build.xml that more or less can be adapted to create diff ejb.ear
if it is possible  it will save loads of time

Reply via email to