Attached are patches to the j2ee plugin that allow you to build ejb jar
files.

k.


Index: build-file.xml
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-maven/xdocs/ref/j2ee/build-file.xml,v
retrieving revision 1.5
diff -u -r1.5 build-file.xml
--- build-file.xml	12 May 2002 14:40:56 -0000	1.5
+++ build-file.xml	17 May 2002 04:04:42 -0000
@@ -3,6 +3,7 @@
 
   <properties>
     <author email="[EMAIL PROTECTED]">dIon Gillard</author>
+    <author email="[EMAIL PROTECTED]">Kevin O'Neill</author>
     <title>Maven J2EE Plug-in Build File Documentation</title>
   </properties>
 
@@ -44,8 +45,8 @@
         <tr>
           <td><a href="#build-j2ee.xml">build-j2ee.xml</a></td>
           <td>
-            Contains targets to create J2EE <code>WAR</code> and 
-            <code>EAR</code> files.
+            Contains targets to create J2EE <code>WAR</code>, <code>EJB</code>
+            and <code>EAR</code> files.
           </td>
         </tr>
       </table>
@@ -71,6 +72,10 @@
           <td>Validate a <code>WAR</code> file.</td>
         </tr>
         <tr>
+          <td><a href="#maven:ejb">maven:ejb</a></td>
+          <td>Creates an <code>EJB</code>jar file.</td>
+        </tr>
+        <tr>
           <td><a href="#maven:ear">maven:ear</a></td>
           <td>Creates an <code>EAR</code> file.</td>
         </tr>
@@ -152,7 +157,64 @@
                 <li>It is readable</li>
                 <li>It contains a WEB-INF/web.xml deployment descriptor</li>
             </ol>
+        </p>                                               
+      </subsection>
+      <subsection name="maven:ejb">
+        <p>
+          The <code>maven:ejb</code> target generates the <code>ejb</code> jar file
+          for the project. Optionally it can also create jars containing the local
+          and remote interfaces. The files are produced in the 
+          <code><a href="../properties.html#Directory Layout Settings">${maven.build.dir}</a>/ejb</code> 
+          directory and have a name based on the
+          <code><a href="properties.html#maven.j2ee.ejb.name">${maven.j2ee.ejb.name}</a></code>
+          property.
+        </p>
+        <p>The files generated are:
+          <ul>
+              <li><code>${maven.j2ee.ejb.name}.jar</code></li>
+              <li><code>${maven.j2ee.ejb.name}-remote.jar</code> <emp>(optional)</emp></li>
+              <li><code>${maven.j2ee.ejb.name}-local.jar</code> <emp>(optional)</emp></li>
+          </ul>
         </p>
+        <p>
+          Maven also includes the license file, LICENSE.txt, if it exists, in 
+          the META-INF directory.
+        </p>
+        <p>
+          The contents of the ejb file include:
+        </p>
+        <table>
+          <tr><th>Item</th><th>Description</th></tr>
+          <tr>
+            <td>ejb-jar.xml</td>
+            <td>
+              A J2EE enterprise bean deployment descriptor, which
+              is placed in the root of the resulting ear file.
+              The <code><a href="properties.html#maven.j2ee.ejb.ejb-xml">${maven.j2ee.ejb.ejb-xml}</a></code> 
+              property defines the location of this file.
+            </td>
+          </tr>
+          <tr>
+            <td>Classes</td>
+            <td>
+              The files in the <code><a href="../properties.html#Directory Layout Settings">${maven.build.dest}</a></code> 
+              directory to be included is specified using the 
+              <code><a href="properties.html#maven.j2ee.ejb.includes">${maven.j2ee.ejb.includes}</a></code>
+              and <code><a href="properties.html#maven.j2ee.ejb.excludes">${maven.j2ee.ejb.excludes}</a></code> 
+              properties.
+            </td>
+          </tr>
+          <tr>
+            <td>Meta-Inf</td>
+            <td>
+              Files to be included the <code>META-INF</code> directory of the ejb
+              jar file may be specified using the  
+              <code><a href="properties.html#maven.j2ee.ejb.meta-inf-includes">${maven.j2ee.ejb.meta-inf-includes}</a></code>
+              and <code><a href="properties.html#maven.j2ee.ejb.meta-inf-excludes">${maven.j2ee.ejb.meta-inf-excludes}</a></code> 
+              properties.
+            </td>
+          </tr>
+        </table>
       </subsection>
       <subsection name="maven:ear">
         <p>
@@ -173,7 +235,7 @@
           the directory META-INF.
         </p>
         <p>
-          The contents of the war file include:
+          The contents of the ear file include:
         </p>
         <table>
           <tr><th>Item</th><th>Description</th></tr>
Index: properties.xml
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-maven/xdocs/ref/j2ee/properties.xml,v
retrieving revision 1.3
diff -u -r1.3 properties.xml
--- properties.xml	12 May 2002 14:40:56 -0000	1.3
+++ properties.xml	17 May 2002 04:05:03 -0000
@@ -3,6 +3,7 @@
 
   <properties>
     <author email="[EMAIL PROTECTED]">dIon Gillard</author>
+    <author email="[EMAIL PROTECTED]">Kevin O'Neill</author>
     <title>Maven J2EE Plug-in Properties Documentation</title>
   </properties>
 
@@ -32,6 +33,13 @@
           </td>
         </tr>
         <tr>
+          <td><a href="#EJB Settings">EJB</a></td>
+          <td>
+            These properties specify various settings that control the build
+            of a ejb jar by the J2EE Plug-in.
+          </td>
+        </tr>
+        <tr>
           <td><a href="#Ear Settings">Ear</a></td>
           <td>
             These properties specify various settings that control the build
@@ -132,6 +140,93 @@
         </tr>
       </table>
     </section>
+    
+    <section name="EJB Settings">
+      <table>
+        <tr><th>Property</th><th>Optional?</th><th>Description</th></tr>
+        <tr>
+          <td><a name="maven.j2ee.ejb.name">maven.j2ee.ejb.name</a></td>
+          <td>No</td>
+          <td>
+            Specifies the name of the ejb jar to be built.
+          </td>
+        </tr>
+        <tr>
+          <td><a name="maven.j2ee.ejb.ejb-xml">maven.j2ee.ejb.ejb-xml</a></td>
+          <td>Yes</td>
+          <td>
+            Specifies the deployment descriptor to be used when building the ejb jar.
+            It will be placed in <code>META-INF</code> directory of the resulting
+            ejb jar. It defaults to
+            <code><a href="../properties.html#Directory Layout Settings">${maven.conf.dir}</a>/<a href="properties.html#maven.j2ee.ejb.name">${maven.j2ee.ejb.name}</a>/ejb-jar.xml</code>
+          </td>
+        </tr>
+        <tr>
+          <td><a name="maven.j2ee.ejb.includes">maven.j2ee.ejb.includes</a></td>
+          <td>Yes</td>
+          <td>
+            Specifies the pattern of files in the 
+            <a href="../properties.html#Directory Layout Settings">${maven.build.dest}</a>
+            directory to be included in the generated ejb jar. Defaults to <code>**/*</code>.
+          </td>
+        </tr>
+        <tr>
+          <td><a name="maven.j2ee.ejb.excludes">maven.j2ee.ejb.includes</a></td>
+          <td>Yes</td>
+          <td>
+            Specifies the pattern of compiled class files to be <strong>excluded</strong> 
+            from the generated ejb jar. Defaults to <code>**/package.html</code>.
+          </td>
+        </tr>
+        <tr>
+          <td><a name="maven.j2ee.ejb.meta-inf-includes">maven.j2ee.ejb.meta-inf-includes</a></td>
+          <td>Yes</td>
+          <td>
+            Specifies the a pattern of files to be included in the <code>META-INF</code>
+            directory of the generated ejb jar. This can be used to include container
+            specific files, for example <code>mvcsoft-pm.xml</code>.
+          </td>
+        </tr>
+        <tr>
+          <td><a name="maven.j2ee.ejb.local.includes">maven.j2ee.ejb.local.includes</a></td>
+          <td>Yes</td>
+          <td>
+            If this property exists then a jar file with the name
+            <code><a href="properties.html#maven.j2ee.ejb.name">${maven.j2ee.ejb.name}</a>-local.jar</code>
+            containing the matching files will be generated in
+            <code><a href="../properties.html#Directory Layout Settings">${maven.build.dir}</a>/ejb</code>.
+          </td>
+        </tr>
+        <tr>
+          <td><a name="maven.j2ee.ejb.local.excludes">maven.j2ee.ejb.local.excludes</a></td>
+          <td>Yes</td>
+          <td>
+            Files to be <strong>excluded</strong> from the 
+            <code><a href="properties.html#maven.j2ee.ejb.name">${maven.j2ee.ejb.name}</a>-local.jar</code>
+          </td>
+        </tr>
+        <tr>
+          <td><a name="maven.j2ee.ejb.remote.includes">maven.j2ee.ejb.remote.includes</a></td>
+          <td>Yes</td>
+          <td>
+            If this property exists then a jar file with the name
+            <code><a href="properties.html#maven.j2ee.ejb.name">${maven.j2ee.ejb.name}</a>-remote.jar</code>
+            containing the matching files will be generated in
+            <code><a href="../properties.html#Directory Layout Settings">${maven.build.dir}</a>/ejb</code>.
+          </td>
+        </tr>
+        <tr>
+          <td><a name="maven.j2ee.ejb.remote.excludes">maven.j2ee.ejb.remote.excludes</a></td>
+          <td>Yes</td>
+          <td>
+            Files to be <strong>excluded</strong> from the 
+            <code><a href="properties.html#maven.j2ee.ejb.name">${maven.j2ee.ejb.name}</a>-remote.jar</code>
+          </td>
+        </tr>
+      </table>
+    </section>
+    
+    
     <section name="Ear Settings">
       <table>
         <tr><th>Property</th><th>Optional?</th><th>Description</th></tr>
@@ -214,6 +309,45 @@
             There is no default for this property.
           </td>
         </tr>
+        
+        <tr>
+          <td><a name="maven.callback.preprocess-ejb.buildFile">maven.callback.preprocess-ejb.buildFile</a></td>
+          <td>Yes</td>
+          <td>
+            Specifies the build file containing the target to call immediately
+            before building the ejb jar.
+            There is no default for this property.
+          </td>
+        </tr>
+        <tr>
+          <td><a name="maven.callback.preprocess-ejb.buildTarget">
+            maven.callback.preprocess-ejb.buildTarget</a></td>
+          <td>Yes</td>
+          <td>
+            Specifies the target to call immediately before building the ejb jar.
+            There is no default for this property.
+          </td>
+        </tr>
+        <tr>
+          <td><a name="maven.callback.postprocess-ejb.buildFile">
+          maven.callback.postprocess-ejb.buildFile</a></td>
+          <td>Yes</td>
+          <td>
+            Specifies the build file containing the target to call immediately
+            after building the ejb jar.
+            There is no default for this property.
+          </td>
+        </tr>
+        <tr>
+          <td><a name="maven.callback.postprocess-ejb.buildTarget">
+          maven.callback.postprocess-ejb.buildTarget</a></td>
+          <td>Yes</td>
+          <td>
+            Specifies the target to call immediately after building the ejb jar.
+            There is no default for this property.
+          </td>
+        </tr>
+
         <tr>
           <td><a name="maven.callback.preprocess-ear.buildFile">
             maven.callback.preprocess-ear.buildFile</a></td>
Index: Control-j2ee.vm
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-maven/src/templates/build/Attic/Control-j2ee.vm,v
retrieving revision 1.4
diff -u -r1.4 Control-j2ee.vm
--- Control-j2ee.vm	12 May 2002 13:41:07 -0000	1.4
+++ Control-j2ee.vm	17 May 2002 04:03:37 -0000
@@ -14,9 +14,10 @@
 $delegators.put("war","build-j2ee.xml")
 $delegators.put("validate-war","build-j2ee.xml")
 $delegators.put("ear","build-j2ee.xml")
+$delegators.put("ejb","build-j2ee.xml")
 
 
 ## -------------------------------------------------------
 ## Make the list of build-j2ee.xml callbacks
 ## -------------------------------------------------------
-$callbacks.put( "j2ee", [ "preprocess-war", "postprocess-war", "preprocess-ear",  "postprocess-ear" ] );
+$callbacks.put( "j2ee", [ "preprocess-war", "postprocess-war", "preprocess-ear",  "postprocess-ear", "preprocess-ejb", "postprocess-ejb" ] );
Index: build-j2ee.xml
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-maven/src/templates/build/Attic/build-j2ee.xml,v
retrieving revision 1.11
diff -u -r1.11 build-j2ee.xml
--- build-j2ee.xml	12 May 2002 14:28:02 -0000	1.11
+++ build-j2ee.xml	17 May 2002 04:02:52 -0000
@@ -36,6 +36,16 @@
                 <available file="${maven.j2ee.ear.appxml}" type="file"/>
             </and>
         </condition>
+
+        <condition property="maven.j2ee.ejb.ready">
+            <and>
+                <not>
+                    <equals arg1="${maven.j2ee.ejb.name}"
+                            arg2="$${maven.j2ee.ejb.name}" />
+                </not>
+                <available file="${maven.j2ee.ejb.ejb-xml}" type="file"/>
+            </and>
+        </condition>
     </target>
   
     <target name="war"
@@ -47,6 +57,7 @@
                  #callback("postprocess-war")"
         description="o Create a war file" />
  
+
     <target name="war-error" unless="maven.j2ee.war.ready">
         <!-- extend this list with requirements as needed -->
         <fail>
@@ -70,16 +81,19 @@
         </fail>
     </target>
       
+
     <target name="war-init" if="maven.j2ee.war.ready">
         <!-- nothing to do as of yet -->
-    </target>    
+    </target>
     
+
     <target name="war-build" if="maven.j2ee.war.ready">
         <!-- make sure the source is compiled -->
         <ant antfile="${maven.home}/build-maven.xml" target="jar" />
 
         <echo>Building WAR ${maven.j2ee.war.name}</echo>
         
+
         <war warfile="${maven.build.dir}/${maven.j2ee.war.name}.war"
              webxml="${maven.j2ee.war.webxml}">
             <fileset dir="${maven.j2ee.war.content}"/>
@@ -105,17 +119,18 @@
                     <attribute name="Implementation-Vendor" value="${maven.organization}" />
                 </section>
             </manifest>
-         </war>
+        </war>
     </target>
 
     <target name="validate-war" depends="local-init">
         <taskdef
           name="warvalidator"
           classname="org.apache.maven.j2ee.WarValidator">
-          <classpath refid="maven-classpath"/>
-          <classpath refid="maven.dependency.classpath"/>
+            <classpath refid="maven-classpath"/>
+            <classpath refid="maven.dependency.classpath"/>
         </taskdef>
         
+
         <warvalidator
             warFileName="${maven.build.dir}/${maven.j2ee.war.name}.war"
             projectDescriptor="project.xml">
@@ -155,6 +170,7 @@
         </fail>
     </target>
         
+
     <target name="ear-init" if="maven.j2ee.ear.ready">
         <!-- nothing to do as of yet -->
     </target>
@@ -162,9 +178,10 @@
     <target name="ear-build" if="maven.j2ee.ear.ready">
         <echo>Building EAR ${maven.j2ee.ear.name}</echo>
         
+
         <ear earfile="${maven.build.dir}/${maven.j2ee.ear.name}.ear"
              appxml="${maven.j2ee.ear.appxml}">
-            <fileset dir="${maven.build.dir}" 
+            <fileset dir="${maven.build.dir}"
                 includes="${maven.j2ee.ear.includes}"
                 excludes="${maven.j2ee.ear.excludes}" />
             <metainf dir="${basedir}">
@@ -181,7 +198,158 @@
                     <attribute name="Implementation-Vendor" value="${maven.organization}" />
                 </section>
             </manifest>
-         </ear>
+        </ear>
     </target>
     
+
+    <!-- 
+        ejb processing 
+    -->
+    <target name="ejb"
+        depends="local-init,
+                 ejb-error,
+                 ejb-init,
+                 #callback("preprocess-ejb"),
+                 ejb-build,
+                 #callback("postprocess-ejb")"
+        description="Create an ejb file" />
+
+    <target name="ejb-error" unless="maven.j2ee.ejb.ready">
+        <!-- extend this list with requirements as needed -->
+        <fail>
+    +------------------------------------------------------------------------------
+    |
+    | ERROR: One of the required properties for maven:ejb was not provided.
+    |
+    |        Please ensure that the property maven.j2ee.ejb.name is defined:
+    |
+    |        maven.j2ee.ejb.name = ${maven.j2ee.ejb.name}
+    |
+    |        and the following files exist:
+    |
+    |        ${maven.j2ee.ejb.ejb-xml}
+    +------------------------------------------------------------------------------
+        </fail>
+    </target>
+        
+
+
+    <target name="ejb-init" if="maven.j2ee.ejb.ready">
+        <dirname property="maven.j2ee.ejb.ejb-xml.dir" file="${maven.j2ee.ejb.ejb-xml}"/>
+        <basename property="maven.j2ee.ejb.ejb-xml.file" file="${maven.j2ee.ejb.ejb-xml}"/>
+        <property name="maven.j2ee.ejb.target-base" value="${maven.build.dir}/ejb/"/>
+    </target>
+
+    <target name="ejb-build" depends="ejb-jar, ejb-remote, ejb-local" if="maven.j2ee.ejb.ready"/>
+
+    <target name="ejb-jar" if="maven.j2ee.ejb.ready">
+    
+        <!-- ejb jar is always built -->
+        <echo>Building EJB jar for ${maven.j2ee.ejb.name}</echo>
+    
+
+        <mkdir dir="${maven.j2ee.ejb.target-base}"/>
+
+        <jar jarfile="${maven.j2ee.ejb.target-base}/${maven.j2ee.ejb.name}.jar" index="true">
+            <fileset dir="${maven.build.dir}/classes"
+                includes="${maven.j2ee.ejb.includes}"
+                excludes="${maven.j2ee.ejb.excludes}" />
+
+            <metainf dir="${basedir}">
+                <include name="LICENSE.txt"/>
+            </metainf>
+      
+
+            <metainf dir="${maven.j2ee.ejb.ejb-xml.dir}">
+                <include name="${maven.j2ee.ejb.ejb-xml.file}"/>
+            </metainf>
+      
+
+            <metainf dir="${maven.j2ee.ejb.meta-inf-includes}">
+                <include name="**/*/"/>
+                <exclude name="ejb-jar.xml"/>
+            </metainf>
+
+            <manifest>
+                <attribute name="Built-By" value="${user.name}" />
+                <section name="${maven.package}">
+                    <attribute name="Specification-Title" value="${maven.id}" />
+                    <attribute name="Specification-Version" value="${maven.currentVersion}" />
+                    <attribute name="Specification-Vendor" value="${maven.organization}" />
+                    <attribute name="Implementation-Title" value="${maven.package}" />
+                    <attribute name="Implementation-Version" value="${maven.currentVersion}" />
+                    <attribute name="Implementation-Vendor" value="${maven.organization}" />
+                </section>
+            </manifest>
+        </jar>
+    </target>
+
+    <target name="ejb-local" if="maven.j2ee.ejb.local.includes">
+    
+        <!-- ejb jar is always built -->
+        <echo>Building EJB local interface jar for ${maven.j2ee.ejb.name}</echo>
+        
+        <!-- in case excludes hasn't been set -->
+        <property name="maven.j2ee.ejb.local.excludes" value=""/>
+
+        <mkdir dir="${maven.j2ee.ejb.target-base}"/>
+
+        <jar jarfile="${maven.j2ee.ejb.target-base}/${maven.j2ee.ejb.name}-local.jar" index="true">
+            <fileset dir="${maven.build.dir}/classes"
+                includes="${maven.j2ee.ejb.local.includes}"
+                excludes="${maven.j2ee.ejb.local.excludes}" />
+
+            <metainf dir="${basedir}">
+                <include name="LICENSE.txt"/>
+            </metainf>
+      
+
+            <manifest>
+                <attribute name="Built-By" value="${user.name}" />
+                <section name="${maven.package}">
+                    <attribute name="Specification-Title" value="${maven.id}" />
+                    <attribute name="Specification-Version" value="${maven.currentVersion}" />
+                    <attribute name="Specification-Vendor" value="${maven.organization}" />
+                    <attribute name="Implementation-Title" value="${maven.package}" />
+                    <attribute name="Implementation-Version" value="${maven.currentVersion}" />
+                    <attribute name="Implementation-Vendor" value="${maven.organization}" />
+                </section>
+            </manifest>
+        </jar>
+    </target>
+
+    <target name="ejb-remote" if="maven.j2ee.ejb.remote.includes">
+    
+        <!-- ejb jar is always built -->
+        <echo>Building EJB remote interface jar for ${maven.j2ee.ejb.name}</echo>
+        
+        <!-- in case excludes hasn't been set -->
+        <property name="maven.j2ee.ejb.remote.excludes" value=""/>
+
+        <mkdir dir="${maven.j2ee.ejb.target-base}"/>
+
+        <jar jarfile="${maven.j2ee.ejb.target-base}/${maven.j2ee.ejb.name}-remote.jar" index="true">
+            <fileset dir="${maven.build.dir}/classes"
+                includes="${maven.j2ee.ejb.remote.includes}"
+                excludes="${maven.j2ee.ejb.remote.excludes}" />
+
+            <metainf dir="${basedir}">
+                <include name="LICENSE.txt"/>
+            </metainf>
+      
+
+            <manifest>
+                <attribute name="Built-By" value="${user.name}" />
+                <section name="${maven.package}">
+                    <attribute name="Specification-Title" value="${maven.id}" />
+                    <attribute name="Specification-Version" value="${maven.currentVersion}" />
+                    <attribute name="Specification-Vendor" value="${maven.organization}" />
+                    <attribute name="Implementation-Title" value="${maven.package}" />
+                    <attribute name="Implementation-Version" value="${maven.currentVersion}" />
+                    <attribute name="Implementation-Vendor" value="${maven.organization}" />
+                </section>
+            </manifest>
+        </jar>
+    </target>
+
 </project>
Index: j2ee.properties
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-maven/src/templates/build/Attic/j2ee.properties,v
retrieving revision 1.8
diff -u -r1.8 j2ee.properties
--- j2ee.properties	7 May 2002 16:56:59 -0000	1.8
+++ j2ee.properties	17 May 2002 04:03:15 -0000
@@ -18,3 +18,39 @@
 maven.j2ee.ear.appxml=${maven.conf.dir}/${maven.j2ee.ear.name}-application.xml
 maven.j2ee.ear.includes=*.jar, *.war
 maven.j2ee.ear.excludes=
+
+######################
+#EJB Target Properties
+######################
+
+# Required
+
+#maven.j2ee.ejb.name
+
+# Defaulted
+
+maven.j2ee.ejb.ejb-xml=${maven.conf.dir}/${maven.j2ee.ejb.name}/ejb-jar.xml
+maven.j2ee.ejb.includes=**
+maven.j2ee.ejb.excludes=**/package.html
+
+# Optional
+
+# Include extra files in the ejb jar META-INF directory 
+#maven.j2ee.ejb.meta-inf-includes=
+
+# Pre-processing
+#maven.callback.preprocess-ejb.buildFile=
+#maven.callback.preprocess-ejb.buildTarget=
+
+# Post-processing
+#maven.callback.postprocess-ejb.buildFile=
+#maven.callback.postprocess-ejb.buildTarget=
+
+# Local Interfaces Jar
+#maven.j2ee.ejb.local.includes=**/interfaces/*Local*.class
+#maven.j2ee.ejb.local.excludes=**/package.html
+
+# Remote Interfaces Jar
+#maven.j2ee.ejb.remote.includes=**/interfaces/*
+#maven.j2ee.ejb.remote.excludes=**/interfaces/*Local*.class
+

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to