felipeal 2004/11/15 19:22:59 Modified: ear plugin.jelly ear/src/plugin-test/test02 maven.xml project.xml ear/xdocs changes.xml properties.xml Log: MPEAR-26: added new dependency property ear.bundle.name Revision Changes Path 1.25 +23 -14 maven-plugins/ear/plugin.jelly Index: plugin.jelly =================================================================== RCS file: /home/cvs/maven-plugins/ear/plugin.jelly,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- plugin.jelly 16 Nov 2004 02:45:56 -0000 1.24 +++ plugin.jelly 16 Nov 2004 03:22:59 -0000 1.25 @@ -71,6 +71,7 @@ </util:available> <!-- include marked dependencies --> + <j:set var="tmpDependenciesDir" value="${maven.build.dir}/tmpEarDeps"/> <j:forEach var="lib" items="${pom.artifacts}"> <j:set var="dep" value="${lib.dependency}"/> <j:if test="${dep.getProperty('ear.bundle')=='true' || dep.getProperty('ear.module')=='true'}"> @@ -85,23 +86,26 @@ </j:if> <ant:echo>Bundling: ${dep.type} - ${dep.id} - ${dep.version}</ant:echo> - <j:set var="targetPath" value="${dep.getProperty('ear.bundle.dir')}"/> - <!-- decide where to include the dependency --> - <j:choose> - <j:when test="${empty(targetPath)}"> - <ant:fileset dir="${lib.file.parent}"> - <ant:include name="${lib.file.name}"/> - </ant:fileset> - </j:when> - <j:otherwise> - <ant:zipfileset dir="${lib.file.parent}" prefix="${targetPath}"> - <ant:include name="${lib.file.name}"/> - </ant:zipfileset> - </j:otherwise> - </j:choose> + <!-- define the directory where the dependency will be included --> + <!-- (if the property is not set, dir is the root) --> + <j:set var="bundleDir" value="${dep.getProperty('ear.bundle.dir')}"/> + <!-- define the name of the dependency --> + <j:set var="bundleName" value="${dep.getProperty('ear.bundle.name')}"/> + <j:if test="${empty(bundleName)}"> + <j:set var="bundleName" value="${lib.file.name}"/> + </j:if> + + <j:set var="bundlePath" value="${bundleDir}/${bundleName}"/> + + <echo>Dependency ${lib.file.name} will be bundled as ${bundlePath}</echo> + + <!-- after the definitions, copy the dependency --> + <ant:copy file="${lib.file.parent}/${lib.file.name}" tofile="${tmpDependenciesDir}/${bundlePath}"/> </j:if> </j:forEach> + <!-- bundle all dependencies that were copied to a temporary dir --> + <ant:fileset dir="${tmpDependenciesDir}"/> <!-- include license --> <j:set var="licenseFileName"><license:fileName/></j:set> @@ -139,6 +143,11 @@ </j:if> </ant:ear> + + <!-- delete temporary directory --> + <util:available file="${tmpDependenciesDir}"> + <ant:delete dir="${tmpDependenciesDir}"/> + </util:available> </goal> 1.3 +10 -2 maven-plugins/ear/src/plugin-test/test02/maven.xml Index: maven.xml =================================================================== RCS file: /home/cvs/maven-plugins/ear/src/plugin-test/test02/maven.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- maven.xml 12 Nov 2004 02:10:32 -0000 1.2 +++ maven.xml 16 Nov 2004 03:22:59 -0000 1.3 @@ -38,11 +38,19 @@ <!-- check for commons-logging --> <assert:assertFileExists file="${unzipDir}/APP-INF/lib/commons-logging-1.0.3.jar" - msg="commons logging was not bundled"/> + msg="commons-logging was not bundled"/> <!-- check that commons-collections has been packaged in the right place--> <assert:assertFileExists file="${unzipDir}/commons-collections-2.1.jar" - msg="commons collections was bundled incorrectly"/> + msg="commons-collections was bundled incorrectly"/> + + <!-- check that commons-digester has been packaged in the right place--> + <assert:assertFileExists file="${unzipDir}/commons-digester.jar" + msg="commons-digester was bundled incorrectly"/> + + <!-- check that log4j has been packaged in the right place--> + <assert:assertFileExists file="${unzipDir}/APP-INF/lib/LOG4J.JAR" + msg="log4j was bundled incorrectly"/> </goal> 1.4 +26 -2 maven-plugins/ear/src/plugin-test/test02/project.xml Index: project.xml =================================================================== RCS file: /home/cvs/maven-plugins/ear/src/plugin-test/test02/project.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- project.xml 16 Nov 2004 02:45:56 -0000 1.3 +++ project.xml 16 Nov 2004 03:22:59 -0000 1.4 @@ -28,8 +28,8 @@ </organization> <inceptionYear>2004</inceptionYear> <package>au.gov.qld</package> - <shortDescription>Test for Jar paths in Ears</shortDescription> - <description>Test that a jar is packaged in the path specified in the project file</description> + <shortDescription>Test for new properties ear.bundle.name and ear.bundle.dir</shortDescription> + <description>Tests if a dependency which has the properties ear.bundle.name or ear.bundle.dir it is properly bundled in the EAR (see issues MPEAR-26 and MPEAR-23)</description> <url/> <developers> <developer> @@ -39,6 +39,11 @@ <organization>Queensland Government</organization> <role>Java Developer</role> </developer> + <developer> + <name>Felipe Leme</name> + <id>felipeal</id> + <role>Jelly Developer</role> + </developer> </developers> <dependencies> <dependency> @@ -56,6 +61,25 @@ <version>2.1</version> <properties> <ear.bundle>true</ear.bundle> + </properties> + </dependency> + <dependency> + <groupId>commons-digester</groupId> + <artifactId>commons-digester</artifactId> + <version>1.6</version> + <properties> + <ear.bundle>true</ear.bundle> + <ear.bundle.name>commons-digester.jar</ear.bundle.name> + </properties> + </dependency> + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>1.2.8</version> + <properties> + <ear.bundle>true</ear.bundle> + <ear.bundle.name>LOG4J.JAR</ear.bundle.name> + <ear.bundle.dir>/APP-INF/lib</ear.bundle.dir> </properties> </dependency> </dependencies> 1.27 +1 -0 maven-plugins/ear/xdocs/changes.xml Index: changes.xml =================================================================== RCS file: /home/cvs/maven-plugins/ear/xdocs/changes.xml,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- changes.xml 16 Nov 2004 02:45:56 -0000 1.26 +++ changes.xml 16 Nov 2004 03:22:59 -0000 1.27 @@ -25,6 +25,7 @@ </properties> <body> <release version="1.6-SNAPSHOT" date="in CVS"> + <action dev="felipeal" type="add" issue="MPEAR-26">Add new property dependency (<code>ear.bundle.name</code>) to define the name a dependency should have the EAR.</action> <action dev="felipeal" type="fix" issue="MPEAR-20">Changed the default value of <code>maven.ear.displayname</code>.</action> <action dev="felipeal" type="add" issue="MPEAR-23" due-to="Wiley Fuller">Add new property dependency(<code>ear.bundle.dir</code>) to define where a dependency should be added in the EAR.</action> <action dev="felipeal" type="fix" issue="MPEAR-9" due-to="Sean Timm">Build now fails in some cases were the dependencies are copied with wrong case.</action> 1.18 +31 -0 maven-plugins/ear/xdocs/properties.xml Index: properties.xml =================================================================== RCS file: /home/cvs/maven-plugins/ear/xdocs/properties.xml,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- properties.xml 16 Nov 2004 02:45:56 -0000 1.17 +++ properties.xml 16 Nov 2004 03:22:59 -0000 1.18 @@ -187,6 +187,37 @@ </properties> </dependency> ]]></source> +<p>(it does not matter if the value of <code>ear.bundle.dir</code> starts with a slash (<code>/</code>) or not - it will always be relative to the root of the EAR)</p> + <p> + It is also possible to change the name by which the dependency will be bundles using the <code>ear.bundle.name</code> property: + </p> + <source><![CDATA[ + <dependency> + <groupId>groupId</groupId> + <artifactId>jarArtifactId</artifactId> + <version>aversion</version> + <type>jar</type> + <properties> + <ear.bundle>true</ear.bundle> + <ear.bundle.name>aJar</ear.bundle.name> + </properties> + </dependency> + ]]></source> +<p>In the example above, the dependency will be bundled simply as <code>aJar</code> and not <code>jarArtifactId.aversion</code>; note that <code>ear.bundle.name</code> and <code>ear.bundle.dir</code> can be used together:</p> + <source><![CDATA[ + <dependency> + <groupId>groupId</groupId> + <artifactId>jarArtifactId</artifactId> + <version>aversion</version> + <type>jar</type> + <properties> + <ear.bundle>true</ear.bundle> + <ear.bundle.name>aJar</ear.bundle.name> + <ear.bundle.dir>/anotherDir</ear.bundle.dir> + </properties> + </dependency> + ]]></source> + <p> Finally, 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:
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]