MPWAR-61: Introduced war.target.filename dependency's property to customize the bundle filename. Note that this property should be used wit the war.target.path property

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@534142 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
snicoll 2007-05-01 16:09:07 +00:00
parent 28538aaa4b
commit 428d590c78
8 changed files with 151 additions and 5 deletions

View File

@ -235,9 +235,15 @@
<!-- END OF TO BE REMOVED --> <!-- END OF TO BE REMOVED -->
<j:set var="targetPath" value="${dep.getProperty('war.target.path')}"/> <j:set var="targetPath" value="${dep.getProperty('war.target.path')}"/>
<j:if test="${!empty(targetPath)}"> <j:set var="targetFileName" value="${dep.getProperty('war.target.filename')}"/>
<ant:copy todir="${maven.war.webapp.dir}/${targetPath}" file="${lib.path}"/> <j:choose>
</j:if> <j:when test="${!empty(targetPath) and empty(targetFileName)}">
<ant:copy todir="${maven.war.webapp.dir}/${targetPath}" file="${lib.path}"/>
</j:when>
<j:when test="${!empty(targetPath) and !empty(targetFileName)}">
<ant:copy tofile="${maven.war.webapp.dir}/${targetPath}/${targetFileName}" file="${lib.path}"/>
</j:when>
</j:choose>
</j:forEach> </j:forEach>
<util:available file="${maven.build.dest}"> <util:available file="${maven.build.dest}">

View File

@ -0,0 +1 @@
Sample license

View File

@ -0,0 +1,33 @@
<!--
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project xmlns:j="jelly:core"
xmlns:assert="assert"
xmlns:u="jelly:util">
<goal name="testPlugin" prereqs="test-war"/>
<goal name="test-war" prereqs="clean">
<attainGoal name="war"/>
<j:set var="warFile" value="${maven.build.dir}/${pom.artifactId}.war"/>
<j:set var="warDir" value="${maven.build.dir}/${pom.artifactId}"/>
<assert:assertFileExists file="${warFile}"/>
<assert:assertFileExists file="${warDir}/libs/commons-logging.jar"/>
</goal>
</project>

View File

@ -0,0 +1,8 @@
#
# Expand properties
maven.war.property.expansion=true
#
# Property being replaced
my.cool.property=${pom.artifactId}

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<project>
<pomVersion>3</pomVersion>
<id>test-maven-war-plugin-target-filename</id>
<name>Maven War Plugin 06</name>
<groupId>maven</groupId>
<currentVersion>1.0</currentVersion>
<organization>
<name>Apache Software Foundation</name>
<url>http://www.apache.org/</url>
<logo>http://maven.apache.org/images/apache-maven-project.png</logo>
</organization>
<inceptionYear>2001</inceptionYear>
<package>org.apache.maven</package>
<logo>http://maven.apache.org/images/maven.gif</logo>
<description>Test for Maven War plugin, tests maven.war.target.filename</description>
<shortDescription>test for maven.war.property.expansion</shortDescription>
<url>http://maven.apache.org/maven-1.x/plugins/war/</url>
<siteDirectory>/www/maven.apache.org/maven-1.x/plugins/war/</siteDirectory>
<repository>
<connection>scm:svn:http://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk/war/</connection>
<url>http://svn.apache.org/viewcvs.cgi/maven/maven-1/plugins/trunk/war/</url>
</repository>
<dependencies>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.4</version>
<url>http://jakarta.apache.org/commons/logging.html</url>
<properties>
<war.target.path>libs</war.target.path>
<war.target.filename>commons-logging.jar</war.target.filename>
</properties>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,26 @@
<!--
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<html>
<body>
<h1>Simple WebApp Home</h1>
<p>
This is a html page for ${my.cool.property}
</p>
</body>
</html>

View File

@ -25,6 +25,10 @@
</properties> </properties>
<body> <body>
<release version="1.6.3-SNAPSHOT" date="in SVN"> <release version="1.6.3-SNAPSHOT" date="in SVN">
<action dev="snicoll" type="fix" issue="MPWAR-61">
Introduced war.target.filename dependency's property to customize the bundle filename. Note
that this property should be used wit the war.target.path property.
</action>
<action dev="snicoll" type="fix" issue="MPWAR-65">Added maven.war.expansion.excludes property <action dev="snicoll" type="fix" issue="MPWAR-65">Added maven.war.expansion.excludes property
to exclude files during a property expansion copy (Fixes corruption of binary files). to exclude files during a property expansion copy (Fixes corruption of binary files).
Applied property expansion to web.xml handling for consistency. Introduced the maven.war.src.filtering Applied property expansion to web.xml handling for consistency. Introduced the maven.war.src.filtering

View File

@ -40,9 +40,12 @@ properties you can use.</p>
<code>/WEB-INF/lib</code></td></tr> <code>/WEB-INF/lib</code></td></tr>
<tr><td><code>war.target.path</code></td><td>This bundles the dependency in the path <tr><td><code>war.target.path</code></td><td>This bundles the dependency in the path
specified relative to the base of the web application.</td></tr> specified relative to the base of the web application.</td></tr>
<tr><td><code>war.target.filename</code></td><td>This specifies the filename of the
the dependency in the path specified by the <code>war.target.path</code> property.</td></tr>
</table> </table>
<p>For example, the following adds commons-lang to <code>/WEB-INF/lib</code> and <p>For example, the following adds commons-lang to <code>/WEB-INF/lib</code>,
myApplet to the <code>/applets</code> directory. myApplet to the <code>/applets</code> directory and anotherApplet in
<code>/applets/another-applet.jar</code>.
</p> </p>
<source><![CDATA[ <source><![CDATA[
<dependency> <dependency>
@ -59,6 +62,15 @@ myApplet to the <code>/applets</code> directory.
<properties> <properties>
<war.target.path>applets</war.target.path> <war.target.path>applets</war.target.path>
</properties> </properties>
</dependency>
<dependency>
<id>anotherApplet</id>
<version>1.2</version>
<properties>
<war.target.path>applets</war.target.path>
<war.target.filename>another-applet.jar</war.target.filename>
</properties>
</dependency>]]></source> </dependency>]]></source>
</subsection> </subsection>
<subsection name="Filtering web.xml"> <subsection name="Filtering web.xml">