MPEAR-26: added new dependency property ear.bundle.name
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@116232 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
1 parent
1a1386b907
commit
e47b170033
5 files changed
+91
-18
No files matched your search
+23
-14
@@ -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>
|
||||
@@ -140,6 +144,11 @@
|
||||
|
||||
</ant:ear>
|
||||
|
||||
<!-- delete temporary directory -->
|
||||
<util:available file="${tmpDependenciesDir}">
|
||||
<ant:delete dir="${tmpDependenciesDir}"/>
|
||||
</util:available>
|
||||
|
||||
</goal>
|
||||
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
@@ -58,6 +63,25 @@
|
||||
<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>
|
||||
<build>
|
||||
<sourceDirectory>${basedir}/src</sourceDirectory>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user