- Apply MPEAR-14

- Added to the plugin tests a check to make sure the ear includes
  the jars marked by ear.bundle and ear.module and that ear.module generates
  a java module in the generated application.xml
- Updated documentation


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114709 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
dion
2004-02-20 04:49:07 +00:00
parent 067127eb43
commit 8201a36b18
7 changed files with 83 additions and 43 deletions

View File

@@ -51,7 +51,7 @@
<!-- include marked dependencies -->
<j:forEach var="lib" items="${pom.artifacts}">
<j:set var="dep" value="${lib.dependency}"/>
<j:if test="${dep.getProperty('ear.bundle')=='true'}">
<j:if test="${dep.getProperty('ear.bundle')=='true' || dep.getProperty('ear.module')=='true'}">
<!--
We know that this dep "wants" to be bundled.
@@ -125,7 +125,7 @@
<x:element name="display-name">${maven.ear.displayname}</x:element>
<j:forEach var="lib" items="${pom.artifacts}">
<j:set var="dep" value="${lib.dependency}"/>
<j:if test="${dep.getProperty('ear.bundle')=='true'}">
<j:if test="${dep.getProperty('ear.bundle')=='true' || dep.getProperty('ear.module')=='true'}">
<j:choose>
<j:when test="${dep.type=='war'}">
<x:element name="module">
@@ -141,9 +141,11 @@
</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:if test="${dep.getProperty('ear.module')=='true'}">
<x:element name="module">
<x:element name="java">${dep.getArtifact()}</x:element>
</x:element>
</j:if>
</j:when>
<j:when test="${dep.type=='rar'}">
<x:element name="module">

View File

@@ -1,4 +1,4 @@
<project xmlns:j="jelly:core" xmlns:u="jelly:util">
<project xmlns:j="jelly:core" xmlns:u="jelly:util" xmlns:x="jelly:xml">
<goal name="testPlugin" prereqs="test-ear">
<attainGoal name="clean"/>
@@ -7,12 +7,43 @@
<goal name="test-ear">
<attainGoal name="ear"/>
<!-- tests that the ear is generated -->
<j:set var="expectedFile"
value="${maven.build.dir}/test-maven-ear-plugin-1.0-SNAPSHOT.ear"/>
<u:file var="file" name="${expectedFile}" />
<j:if test="${!(file.exists())}">
<fail>${expectedFile} not generated</fail>
</j:if>
<!-- unzip the ear and look for the jars -->
<j:set var="earFile"
value="${maven.build.dir}/test-maven-ear-plugin-1.0-SNAPSHOT.ear"/>
<j:set var="unzipDir" value= "${maven.build.dir}/eartest"/>
<mkdir dir="${unzipDir}"/>
<unzip src="${earFile}" dest="${unzipDir}"/>
<!-- check for commons-logging -->
<j:set var="expectedFile" value="${unzipDir}/commons-logging-1.0.3.jar"/>
<u:file var="file" name="${expectedFile}" />
<j:if test="${!(file.exists())}">
<fail>${expectedFile} not bundled</fail>
</j:if>
<!-- check for commons-collections -->
<j:set var="expectedFile" value="${unzipDir}/commons-collections-2.1.jar"/>
<u:file var="file" name="${expectedFile}" />
<j:if test="${!(file.exists())}">
<fail>${expectedFile} not bundled</fail>
</j:if>
<!-- check application.xml got a java module in it -->
<u:file var="appXml" name="${unzipDir}/META-INF/application.xml"/>
<x:parse var="applicationDoc" xml="${appXml.toURL()}"/>
<x:set var="firstJavaModule" select="string($applicationDoc/application/module/java)"/>
<echo>output is ${a}</echo>
<j:if test="${firstJavaModule != 'commons-collections-2.1.jar'}">
<fail>
commons-collections-2.1.jar not bundled as a java module found '${firstJavaModule}' instead
</fail>
</j:if>
</goal>
</project>

View File

@@ -1,10 +1,3 @@
maven.deployable.component=${maven.final.name}.ear
maven.j2ee.ear.appxml=${maven.conf.dir}/application.xml
maven.weblogic.home=C:\\bea\\wlserver6.1
maven.weblogic.host=localhost
maven.weblogic.port=7001
maven.weblogic.server=myserver
maven.weblogic.username=system
maven.weblogic.password=weblogic
maven.weblogic.component=${maven.final.name}
maven.weblogic.debug=true
maven.ear.appxml.generate=true

View File

@@ -40,7 +40,24 @@
<version>1.0.3</version>
<url>http://jakarta.apache.org/commons/logging.html</url>
<properties>
<ear.bundle.jar>true</ear.bundle.jar>
<ear.bundle>true</ear.bundle>
</properties>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>2.1</version>
<url>http://jakarta.apache.org/commons/collections/</url>
<properties>
<ear.module>true</ear.module>
</properties>
</dependency>
<dependency>
<groupId>commons-jelly</groupId>
<artifactId>commons-jelly-tags-xml</artifactId>
<version>20030211.142705</version>
<properties>
<classloader>root.maven</classloader>
</properties>
</dependency>
</dependencies>
@@ -49,16 +66,5 @@
<sourceDirectory>src</sourceDirectory>
<unitTestSourceDirectory>src/test</unitTestSourceDirectory>
<!-- Resources that are packaged up inside the JAR file -->
<resources>
<!--includes>
<include>*.xsd</include>
<include>log4j.properties</include>
</includes-->
</resources>
<!-- Integration unit test cases -->
<integrationUnitTest/>
<jars></jars>
</build>
</project>

View File

@@ -1,15 +0,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>workflow ejb app</display-name>
<module>
<ejb>workflow.jar</ejb>
</module>
<module>
<ejb>business.jar</ejb>
</module>
<module>
<ejb>begin_workflow.jar</ejb>
</module>
</application>

View File

@@ -7,6 +7,14 @@
<body>
<release version="1.4" date="in CVS">
<action dev="dion" type="fix" issue="MPEAR-14">
Introduced ear.module property to mark jars as being java client modules
</action>
<action dev="dion" type="update">
Added to the plugin tests a check to make sure the ear includes
the jars marked by ear.bundle and ear.module and that ear.module generates
a java module in the generated application.xml
</action>
</release>
<release version="1.3" date="2003-11-26">

View File

@@ -101,7 +101,7 @@
<dependency>
<id>id</id>
<version>aversion</version>
<type>jar<type>
<type>ejb<type>
<properties>
<ear.bundle>true</ear.bundle>
</properties>
@@ -124,7 +124,22 @@
</properties>
</dependency>
]]></source>
<p>
Please note that if a jar is a java client module, you will need to declare
it using the <code>ear.module</code> property, rather than ear.bundle:
</p>
<source><![CDATA[
<dependency>
<id>my-java-client</id>
<version>aversion</version>
<type>jar<type>
<properties>
<ear.module>true</ear.module>
</properties>
</dependency>
]]></source>
</section>
</body>
</document>