You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by mi...@apache.org on 2003/05/08 22:53:55 UTC
cvs commit: maven/src/plugins-build/ear project.xml plugin.jelly plugin.properties
michal 2003/05/08 13:53:55
Modified: src/plugins-build/ear/xdocs properties.xml goals.xml
changes.xml
src/plugins-build/ear project.xml plugin.jelly
plugin.properties
Log:
- Added auto generation of application.xml file
- Process of bundling artifacts in ear is type senstive now
Revision Changes Path
1.2 +65 -7 maven/src/plugins-build/ear/xdocs/properties.xml
Index: properties.xml
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/ear/xdocs/properties.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- properties.xml 24 Jan 2003 03:45:09 -0000 1.1
+++ properties.xml 8 May 2003 20:53:55 -0000 1.2
@@ -20,6 +20,42 @@
src/application/META-INF/MANIFEST.MF
</td>
</tr>
+ <tr>
+ <td>maven.j2ee.ear.appxml</td>
+ <td>Yes</td>
+ <td>
+ Location of the application.xml file
+ to be used within the ear file.
+ </td>
+ <td>
+ src/application/META-INF/application.xml
+ </td>
+ </tr>
+ <tr>
+ <td>maven.j2ee.ear.appxml.generate</td>
+ <td>Yes</td>
+ <td>
+ Indicates if application.xml files should
+ be autogenerated
+ </td>
+ <td>
+ false
+ </td>
+ </tr>
+ <tr>
+ <td>maven.ear.displayname</td>
+ <td>Yes</td>
+ <td>
+ Display name of the application to be used
+ when application.xml file is autogenerated
+ </td>
+ <td>
+ ${pom.id}
+ </td>
+ </tr>
+
+
+
</table>
</section>
<section name="other settings">
@@ -41,23 +77,45 @@
</tr>
</table>
</section>
- <section name="Including jars in the ear file">
+ <section name="Including artifacts in the ear file">
<p>
- You must tell Maven what jars you want included in the ear. This
- is achieved by specifying meta-information in the POM, using the
+ You must tell Maven what artifact you want to include in the ear.
+ This operation is type sensitive.
+ Maven can bundle in ear artifacts of following types: jar, war, ejb.
+ Artifacts of other types are ignored.
+ This is achieved by specifying meta-information in the POM, using the
following syntax:
</p>
<source><![CDATA[
<dependency>
- <id>jarid</id>
- <version>jarversion</version>
+ <id>id</id>
+ <version>aversion</version>
+ <type>jar<type>
<properties>
- <ear.bundle.jar>true</ear.bundle.jar>
+ <ear.bundle>true</ear.bundle>
</properties>
</dependency>
]]></source>
-
+ </p>
+
+ <p>
+ Those artifact will be also "visible" during generation
+ of application.xml file. In case of war artifacts you can also
+ specify context root which will be set in application.xml file:
+ </p>
+ <source><![CDATA[
+ <dependency>
+ <id>your_war</id>
+ <version>your_version</version>
+ <type>war<type>
+ <properties>
+ <ear.bundle>true</ear.bundle>
+ <ear.appxml.context-root>maven</ear.appxml.war.context-root>
+ </properties>
+ </dependency>
+ ]]></source>
+
</section>
</body>
</document>
1.2 +8 -0 maven/src/plugins-build/ear/xdocs/goals.xml
Index: goals.xml
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/ear/xdocs/goals.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- goals.xml 24 Jan 2003 03:45:09 -0000 1.1
+++ goals.xml 8 May 2003 20:53:55 -0000 1.2
@@ -28,5 +28,13 @@
</description>
</goal>
</goals>
+
+ <goal>
+ <name>ear:generate-ear-descriptor</name>
+ <description>
+ Generates application.xml
+ file based on information from POM
+ </description>
+ </goal>
</body>
</document>
1.2 +5 -0 maven/src/plugins-build/ear/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/ear/xdocs/changes.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- changes.xml 24 Jan 2003 03:45:09 -0000 1.1
+++ changes.xml 8 May 2003 20:53:55 -0000 1.2
@@ -10,6 +10,11 @@
Initial plugin created
</action>
</release>
+ <release version="1.1" date="2003-05-08">
+ <action dev="michal" type="add">
+ Added autogeneration of application.xml file
+ </action>
+ </release>
</body>
</document>
1.9 +10 -1 maven/src/plugins-build/ear/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/ear/project.xml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- project.xml 9 Apr 2003 01:06:45 -0000 1.8
+++ project.xml 8 May 2003 20:53:55 -0000 1.9
@@ -5,7 +5,7 @@
<pomVersion>3</pomVersion>
<id>maven-ear-plugin</id>
<name>Maven EAR Plugin</name>
- <currentVersion>1.0</currentVersion>
+ <currentVersion>1.1</currentVersion>
<description>Ear Plugin for Maven</description>
<shortDescription>Ear Plugin for Maven</shortDescription>
<url>http://maven.apache.org/reference/plugins/ear/</url>
@@ -30,6 +30,15 @@
<name>dIon Gillard</name>
<id>dion</id>
<email>dion@apache.org</email>
+ <organization/>
+ <roles>
+ <role>Java Developer</role>
+ </roles>
+ </developer>
+ <developer>
+ <name>Michal Maczka</name>
+ <id>michal</id>
+ <email>michal.maczka@dimatics.com</email>
<organization/>
<roles>
<role>Java Developer</role>
1.7 +79 -21 maven/src/plugins-build/ear/plugin.jelly
Index: plugin.jelly
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/ear/plugin.jelly,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- plugin.jelly 30 Mar 2003 16:17:19 -0000 1.6
+++ plugin.jelly 8 May 2003 20:53:55 -0000 1.7
@@ -4,7 +4,9 @@
xmlns:j="jelly:core"
xmlns:ant="jelly:ant"
xmlns:license="license"
- xmlns:util="jelly:util">
+ xmlns:util="jelly:util"
+ xmlns:x="jelly:xml"
+ >
<!--==================================================================-->
<!-- Default goal : Builds a ear file -->
@@ -24,11 +26,18 @@
<!--==================================================================-->
<goal name="ear:ear" prereqs="ear:init" description="Build an ear file">
- <ant:echo>Building EAR ${maven.final.name} with appxml "${maven.ear.appxml}"</ant:echo>
-
<ant:mkdir dir="${maven.build.dir}" />
-
-
+
+ <j:set var="isGenerateAppXML"
+ value="${context.getVariable('maven.ear.appxml.generate')}"/>
+ <j:if test="${isGenerateAppXML == 'true'}">
+ <!-- make sure that target directory exists -->
+ <ant:mkdir dir="${maven.ear.descriptordir}"/>
+ <attainGoal name="ear:generate-ear-descriptor"/>
+ </j:if >
+
+ <ant:echo>Building EAR ${maven.final.name} with appxml "${maven.ear.appxml}"</ant:echo>
+
<ant:available property="maven.ear.manifest.available"
file="${maven.ear.manifest}"/>
@@ -39,21 +48,26 @@
<!-- include marked dependencies -->
<j:forEach var="dep" items="${pom.dependencies}">
- <j:if test="${dep.getProperty('ear.bundle.jar')=='true'}">
- <ant:fileset dir="${maven.repo.local}/${dep.artifactDirectory}/jars/">
- <ant:include name="${dep.artifact}"/>
- </ant:fileset>
- </j:if>
- <j:if test="${dep.getProperty('ear.bundle.war')=='true'}">
- <ant:fileset dir="${maven.repo.local}/${dep.artifactDirectory}/wars/">
- <ant:include name="${dep.artifact}"/>
- </ant:fileset>
- </j:if>
- <j:if test="${dep.getProperty('ear.bundle.ejb')=='true'}">
- <ant:fileset dir="${maven.repo.local}/${dep.artifactDirectory}/ejbs/">
- <ant:include name="${dep.artifact}"/>
- </ant:fileset>
- </j:if>
+ <j:if test="${dep.getProperty('ear.bundle')=='true'}">
+ <ant:echo>Bundling: ${dep.type}</ant:echo>
+ <j:choose>
+ <j:when test="${dep.type == 'jar'}">
+ <ant:fileset dir="${maven.repo.local}/${dep.artifactDirectory}/jars/">
+ <ant:include name="${dep.artifact}"/>
+ </ant:fileset>
+ </j:when>
+ <j:when test="${dep.type == 'war' }">
+ <ant:fileset dir="${maven.repo.local}/${dep.artifactDirectory}/wars/">
+ <ant:include name="${dep.artifact}"/>
+ </ant:fileset>
+ </j:when>
+ <j:when test="${dep.type == 'ejb' }">
+ <ant:fileset dir="${maven.repo.local}/${dep.artifactDirectory}/ejbs/">
+ <ant:include name="${dep.artifact}"/>
+ </ant:fileset>
+ </j:when>
+ </j:choose>
+ </j:if>
</j:forEach>
<!-- include license -->
@@ -100,7 +114,51 @@
<ant:mkdir dir="${maven.ear.install.dir}"/>
<ant:copy file="${maven.build.dir}/${maven.final.name}.ear"
tofile="${maven.ear.install.dir}/${maven.final.name}.ear"/>
-
+
</goal>
+
+ <!--==================================================================-->
+ <!-- Creates ear descriptor - application.xml file -->
+ <!--==================================================================-->
+ <goal name="ear:generate-ear-descriptor" description="Generates the ear descriptor">
+
+ <ant:echo>Generating appxml file:"${maven.ear.appxml}"</ant:echo>
+
+ <j:file name="${maven.ear.appxml}"
+ outputMode="xml"
+ prettyPrint="true"
+ encoding="UTF-8"
+ >
+ <x:element name="application">
+ <x:element name="display-name">${maven.ear.displayname}</x:element>
+ <j:forEach var="dep" items="${pom.dependencies}">
+ <j:if test="${dep.getProperty('ear.bundle')=='true'}">
+ <j:choose>
+ <j:when test="${dep.type=='war'}">
+ <x:element name="module">
+ <x:element name="web">
+ <x:element name="web-uri">${dep.getArtifact()}</x:element>
+ <x:element name="context-root">${dep.getProperty('ear.appxml.war.context-root')}</x:element>
+ </x:element>
+ </x:element>
+ </j:when>
+ <j:when test="${dep.type=='ejb'}">
+ <x:element name="module">
+ <x:element name="ejb">${dep.getArtifact()}</x:element>
+ </x:element>
+ </j:when>
+ <j:when test="${dep.type=='jar'}">
+ <x:element name="module">
+ <x:element name="java">${dep.getArtifact()}</x:element>
+ </x:element>
+ </j:when>
+ </j:choose>
+ </j:if>
+ </j:forEach>
+ </x:element>
+ </j:file>
+
+ </goal>
+
</project>
1.2 +2 -1 maven/src/plugins-build/ear/plugin.properties
Index: plugin.properties
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/ear/plugin.properties,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- plugin.properties 24 Jan 2003 03:45:09 -0000 1.1
+++ plugin.properties 8 May 2003 20:53:55 -0000 1.2
@@ -9,4 +9,5 @@
maven.ear.descriptordir=${maven.ear.src}/META-INF
maven.ear.appxml=${maven.ear.descriptordir}/application.xml
maven.ear.manifest=${maven.ear.descriptordir}/MANIFEST.MF
-
+maven.ear.appxml.generate=false
+maven.ear.displayname=${pom.id}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org