Allow customizing of MANIFEST.MF.

Add test cases for the customization


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114957 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
dion 2004-03-31 04:35:30 +00:00
parent 96cb1d5a48
commit c9f3ef25d4
8 changed files with 39 additions and 15 deletions

View File

@ -56,6 +56,9 @@
<ant:echo>Building WAR ${pom.artifactId}</ant:echo>
<ant:available property="maven.war.manifest.available"
file="${maven.war.manifest}"/>
<ant:mkdir dir="${maven.war.build.dir}" />
<ant:jar
destfile="${maven.war.build.dir}/${maven.war.final.name}"
@ -66,6 +69,10 @@
<ant:include name="${licenseFile.canonicalFile.name}"/>
</ant:metainf>
<j:if test="${maven.war.manifest.available}">
<ant:setProperty name="manifest" value="${maven.war.manifest}" />
</j:if>
<ant:manifest>
<ant:attribute name="Built-By" value="${user.name}" />
<ant:section name="${pom.package}">

View File

@ -40,3 +40,5 @@ maven.war.build.dir = ${maven.build.dir}
# ${maven.war.build.dir}/${pom.artifactId}
maven.war.webapp.dir = ${maven.war.build.dir}/${pom.artifactId}
maven.war.tld.dir=WEB-INF/tld
maven.jar.manifest=${pom.build.sourceDirectory}/META-INF/MANIFEST.MF

View File

@ -23,7 +23,7 @@
<pomVersion>3</pomVersion>
<id>maven-war-plugin</id>
<name>Maven WAR Plugin</name>
<currentVersion>1.5</currentVersion>
<currentVersion>1.6-SNAPSHOT</currentVersion>
<description>War Plugin for Maven</description>
<shortDescription>War Plugin for Maven</shortDescription>
<url>http://maven.apache.org/reference/plugins/war/</url>

View File

@ -15,7 +15,9 @@
* limitations under the License.
*/
-->
<project xmlns:j="jelly:core" xmlns:u="jelly:util">
<project xmlns:j="jelly:core"
xmlns:assert="assert"
xmlns:u="jelly:util">
<goal name="testPlugin" prereqs="test-war">
<attainGoal name="clean"/>
@ -23,20 +25,19 @@
<goal name="test-war">
<attainGoal name="war"/>
<j:set var="warFile" value="${maven.build.dir}/test-maven-war-plugin.war"/>
<j:set var="warDir" value="${maven.build.dir}/test-maven-war-plugin"/>
<assert:assertFileExists file="${warFile}"/>
<assert:assertFileExists file="${warDir}/WEB-INF/lib/commons-logging-1.0.3.jar"/>
<j:set var="expectedFile"
value="${maven.build.dir}/test-maven-war-plugin.war"/>
<u:file var="file" name="${expectedFile}" />
<j:if test="${!(file.exists())}">
<fail>${expectedFile} not generated</fail>
<!-- check for manifest contents -->
<j:set var="unzipDir" value="${maven.build.dir}/unzippedWar"/>
<mkdir dir="${unzipDir}"/>
<unzip src="${warFile}" dest="${unzipDir}"/>
<u:loadText var="manifest" file="${unzipDir}/META-INF/MANIFEST.MF"/>
<j:set var="found" value='${manifest.indexOf("Bogus: value") ge 0}'/>
<j:if test="${!found}">
<fail>Manifest not merged</fail>
</j:if>
<j:set var="expectedFile"
value="${maven.build.dir}/test-maven-war-plugin/WEB-INF/lib/commons-logging-1.0.3.jar"/>
<u:file var="file" name="${expectedFile}" />
<j:if test="${!(file.exists())}">
<fail>${expectedFile} not generated</fail>
</j:if>
</goal>
</project>

View File

@ -0,0 +1 @@
maven.war.manifest=${basedir}/src/MANIFEST.MF

View File

@ -0,0 +1 @@
Bogus: value

View File

@ -24,6 +24,10 @@
<author email="vmassol@apache.org">Vincent Massol</author>
</properties>
<body>
<release version="1.6" date="in CVS">
<action dev="dion" type="update" issue="MPWAR-22">Allow customizing of MANIFEST.MF</action>
</release>
<release version="1.5" date="2004-03-07">
<action dev="dion" type="fix">Fix for MAVEN-986. Allow resources to be copied when no sources present</action>
<action dev="vmassol" type="add">Use the new

View File

@ -112,6 +112,14 @@
<code>${maven.war.build.dir}/${pom.artifactId}</code>.
</td>
</tr>
<tr>
<td>maven.war.manifest</td>
<td>Yes</td>
<td>
Location of the MANIFEST.MF file in the source tree. It defaults to
<code>${pom.build.sourceDirectory}/META-INF/MANIFEST.MF</code>.
</td>
</tr>
<tr>
<td>maven.war.index</td>
<td>Yes</td>