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:
parent
96cb1d5a48
commit
c9f3ef25d4
@ -56,6 +56,9 @@
|
|||||||
|
|
||||||
<ant:echo>Building WAR ${pom.artifactId}</ant:echo>
|
<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:mkdir dir="${maven.war.build.dir}" />
|
||||||
<ant:jar
|
<ant:jar
|
||||||
destfile="${maven.war.build.dir}/${maven.war.final.name}"
|
destfile="${maven.war.build.dir}/${maven.war.final.name}"
|
||||||
@ -66,6 +69,10 @@
|
|||||||
<ant:include name="${licenseFile.canonicalFile.name}"/>
|
<ant:include name="${licenseFile.canonicalFile.name}"/>
|
||||||
</ant:metainf>
|
</ant:metainf>
|
||||||
|
|
||||||
|
<j:if test="${maven.war.manifest.available}">
|
||||||
|
<ant:setProperty name="manifest" value="${maven.war.manifest}" />
|
||||||
|
</j:if>
|
||||||
|
|
||||||
<ant:manifest>
|
<ant:manifest>
|
||||||
<ant:attribute name="Built-By" value="${user.name}" />
|
<ant:attribute name="Built-By" value="${user.name}" />
|
||||||
<ant:section name="${pom.package}">
|
<ant:section name="${pom.package}">
|
||||||
|
|||||||
@ -40,3 +40,5 @@ maven.war.build.dir = ${maven.build.dir}
|
|||||||
# ${maven.war.build.dir}/${pom.artifactId}
|
# ${maven.war.build.dir}/${pom.artifactId}
|
||||||
maven.war.webapp.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.war.tld.dir=WEB-INF/tld
|
||||||
|
|
||||||
|
maven.jar.manifest=${pom.build.sourceDirectory}/META-INF/MANIFEST.MF
|
||||||
@ -23,7 +23,7 @@
|
|||||||
<pomVersion>3</pomVersion>
|
<pomVersion>3</pomVersion>
|
||||||
<id>maven-war-plugin</id>
|
<id>maven-war-plugin</id>
|
||||||
<name>Maven WAR Plugin</name>
|
<name>Maven WAR Plugin</name>
|
||||||
<currentVersion>1.5</currentVersion>
|
<currentVersion>1.6-SNAPSHOT</currentVersion>
|
||||||
<description>War Plugin for Maven</description>
|
<description>War Plugin for Maven</description>
|
||||||
<shortDescription>War Plugin for Maven</shortDescription>
|
<shortDescription>War Plugin for Maven</shortDescription>
|
||||||
<url>http://maven.apache.org/reference/plugins/war/</url>
|
<url>http://maven.apache.org/reference/plugins/war/</url>
|
||||||
|
|||||||
@ -15,7 +15,9 @@
|
|||||||
* limitations under the License.
|
* 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">
|
<goal name="testPlugin" prereqs="test-war">
|
||||||
<attainGoal name="clean"/>
|
<attainGoal name="clean"/>
|
||||||
@ -23,20 +25,19 @@
|
|||||||
|
|
||||||
<goal name="test-war">
|
<goal name="test-war">
|
||||||
<attainGoal name="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"
|
<!-- check for manifest contents -->
|
||||||
value="${maven.build.dir}/test-maven-war-plugin.war"/>
|
<j:set var="unzipDir" value="${maven.build.dir}/unzippedWar"/>
|
||||||
<u:file var="file" name="${expectedFile}" />
|
<mkdir dir="${unzipDir}"/>
|
||||||
<j:if test="${!(file.exists())}">
|
<unzip src="${warFile}" dest="${unzipDir}"/>
|
||||||
<fail>${expectedFile} not generated</fail>
|
<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: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>
|
</goal>
|
||||||
</project>
|
</project>
|
||||||
1
war/src/plugin-test/project.properties
Normal file
1
war/src/plugin-test/project.properties
Normal file
@ -0,0 +1 @@
|
|||||||
|
maven.war.manifest=${basedir}/src/MANIFEST.MF
|
||||||
1
war/src/plugin-test/src/MANIFEST.MF
Normal file
1
war/src/plugin-test/src/MANIFEST.MF
Normal file
@ -0,0 +1 @@
|
|||||||
|
Bogus: value
|
||||||
@ -24,6 +24,10 @@
|
|||||||
<author email="vmassol@apache.org">Vincent Massol</author>
|
<author email="vmassol@apache.org">Vincent Massol</author>
|
||||||
</properties>
|
</properties>
|
||||||
<body>
|
<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">
|
<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="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
|
<action dev="vmassol" type="add">Use the new
|
||||||
|
|||||||
@ -112,6 +112,14 @@
|
|||||||
<code>${maven.war.build.dir}/${pom.artifactId}</code>.
|
<code>${maven.war.build.dir}/${pom.artifactId}</code>.
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</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>
|
<tr>
|
||||||
<td>maven.war.index</td>
|
<td>maven.war.index</td>
|
||||||
<td>Yes</td>
|
<td>Yes</td>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user