On Thu, 2002-05-23 at 12:13, Kevin O'Neill wrote:

> Here's a new version of the patch that build an ejb jar file. It's all upto date
> with this mornings code base. 

Of course the patch would be handy.

k.
Index: xdocs/ref/j2ee/build-file.xml
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-maven/xdocs/ref/j2ee/build-file.xml,v
retrieving revision 1.10
diff -u -r1.10 build-file.xml
--- xdocs/ref/j2ee/build-file.xml	21 May 2002 01:20:33 -0000	1.10
+++ xdocs/ref/j2ee/build-file.xml	23 May 2002 01:57:15 -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="#j2ee/build.xml">j2ee-build.xml</a></td>
           <td>
-            Contains targets to create and validate J2EE <code>WAR</code> and 
-            <code>EAR</code> files
+            Contains targets to create and validate J2EE <code>WAR</code>
+            and <code>EAR</code> files. Creates <code>EJB</code> jar 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>
@@ -164,7 +169,64 @@
                 <li>Login and error pages specified in the <code>&lt;form-login-config
                     &gt;</code> element must exist in the war file</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>
@@ -185,7 +247,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: xdocs/ref/j2ee/properties.xml
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-maven/xdocs/ref/j2ee/properties.xml,v
retrieving revision 1.4
diff -u -r1.4 properties.xml
--- xdocs/ref/j2ee/properties.xml	15 May 2002 19:17:45 -0000	1.4
+++ xdocs/ref/j2ee/properties.xml	23 May 2002 01:57:15 -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,46 @@
             There is no default for this property.
           </td>
         </tr>
+        
+        <tr>
+          <td><a name="maven.j2ee.callback.pre-ejb.buildFile">
+            maven.j2ee.callback.pre-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.j2ee.callback.pre-ejb.buildTarget">
+            maven.j2ee.callback.pre-ejb.buildFile</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.j2ee.callback.post-ejb.buildFile">
+          maven.j2ee.callback.post-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.j2ee.callback.post-ejb.buildTarget">
+          maven.j2ee.callback.post-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.j2ee.callback.pre-ear.buildFile">
             maven.j2ee.callback.pre-ear.buildFile</a></td>
Index: src/templates/build/plugins/j2ee/Control.vm
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-maven/src/templates/build/plugins/j2ee/Control.vm,v
retrieving revision 1.3
diff -u -r1.3 Control.vm
--- src/templates/build/plugins/j2ee/Control.vm	22 May 2002 05:12:47 -0000	1.3
+++ src/templates/build/plugins/j2ee/Control.vm	23 May 2002 01:57:15 -0000
@@ -13,9 +13,10 @@
 ## -------------------------------------------------------
 $delegators.put("war",          "plugins/$plugin/build.xml")
 $delegators.put("validate-war", "plugins/$plugin/build.xml")
+$delegators.put("ejb",          "plugins/$plugin/build.xml")
 $delegators.put("ear",          "plugins/$plugin/build.xml")
 
 ## -------------------------------------------------------
 ## Make the list of build-j2ee.xml callbacks
 ## -------------------------------------------------------
-$callbacks.put( "$plugin", [ "pre-war", "post-war", "pre-validate-war", "post-validate-war", "pre-ear",  "post-ear" ] )
+$callbacks.put( "$plugin", [ "pre-war", "post-war", "pre-ejb", "post-ejb", "pre-validate-war", "post-validate-war", "pre-ear",  "post-ear" ] )
Index: src/templates/build/plugins/j2ee/build.xml
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-maven/src/templates/build/plugins/j2ee/build.xml,v
retrieving revision 1.3
diff -u -r1.3 build.xml
--- src/templates/build/plugins/j2ee/build.xml	15 May 2002 19:17:44 -0000	1.3
+++ src/templates/build/plugins/j2ee/build.xml	23 May 2002 01:57:15 -0000
@@ -34,6 +34,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"
@@ -178,7 +188,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("pre-ejb"),
+                 ejb-build,
+                 #callback("post-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: src/templates/build/plugins/j2ee/default.properties
===================================================================
RCS file: /home/cvspublic/jakarta-turbine-maven/src/templates/build/plugins/j2ee/default.properties,v
retrieving revision 1.1
diff -u -r1.1 default.properties
--- src/templates/build/plugins/j2ee/default.properties	14 May 2002 17:59:42 -0000	1.1
+++ src/templates/build/plugins/j2ee/default.properties	23 May 2002 01:57:16 -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