MPWAR-47: Specification and Implementation attributes of the manifest are now defined as main attributes.

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@412476 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
snicoll
2006-06-07 18:22:28 +00:00
parent 8bc43107a1
commit 88c1fc983e
3 changed files with 62 additions and 16 deletions

View File

@@ -43,10 +43,16 @@
<!-- Builds a war file -->
<!--==================================================================-->
<goal name="war:war" prereqs="war:webapp" description="Build a war file">
<j:choose>
<j:when test="${pom.currentVersion == null}">
<ant:fail>You must define currentVersion in your POM.</ant:fail>
</j:when>
</j:choose>
<ant:echo>Building WAR ${pom.artifactId}</ant:echo>
<!-- build dependency list -->
<!-- build dependency list -->
<j:forEach var="dep" items="${pom.dependencies}">
<j:if test="${dep.getProperty('war.manifest.classpath')=='true'}">
<j:set var="maven.war.classpath" value="${maven.war.classpath} ${dep.artifact}"/>
@@ -56,6 +62,12 @@
<ant:available property="maven.war.manifest.available"
file="${maven.war.manifest}"/>
<j:set var="specificationTitle" value="${pom.shortDescription.trim()}"/>
<j:if test="${specificationTitle.length() gt 49}">
<ant:echo>Warning: shortDescription is greater than 49 characters - trimming for specification title.</ant:echo>
<j:set var="specificationTitle" value="${specificationTitle.substring(0,46)}..."/>
</j:if>
<ant:mkdir dir="${maven.war.build.dir}" />
<ant:jar
destfile="${maven.war.build.dir}/${maven.war.final.name}"
@@ -73,25 +85,48 @@
</j:if>
<ant:manifest>
<ant:attribute name="Built-By" value="${user.name}"/>
<j:set var="mavenVersion" value="${maven.application.version}"/>
<j:if test="${mavenVersion != null}">
<ant:attribute name="Maven-Version" value="${mavenVersion}"/>
</j:if>
<j:set var="classPath" value="${maven.war.classpath}"/>
<j:if test="${!empty(classPath)}">
<ant:attribute name="Class-Path" value="${maven.war.classpath}"/>
</j:if>
<ant:attribute name="Built-By" value="${user.name}" />
<ant:section name="${pom.package}">
<ant:attribute name="Specification-Title" value="${pom.artifactId}" />
<ant:attribute name="Specification-Version"
value="${pom.currentVersion}" />
<ant:attribute name="Specification-Vendor"
value="${pom.organization.name}" />
<ant:attribute name="Implementation-Title"
value="${pom.package}" />
<ant:attribute name="Implementation-Version"
value="${pom.currentVersion}" />
<ant:attribute name="Implementation-Vendor"
value="${pom.organization.name}" />
</ant:section>
<!-- Remove SNAPSHOT -->
<j:choose>
<j:when test="${pom.currentVersion.endsWith('-SNAPSHOT')}">
<j:invokeStatic className="org.apache.commons.lang.StringUtils" method="substringBeforeLast" var="pomCurrentVersion">
<j:arg value="${pom.currentVersion}" type="java.lang.String"/>
<j:arg value="-SNAPSHOT" type="java.lang.String"/>
</j:invokeStatic>
</j:when>
<j:otherwise>
<j:set var="pomCurrentVersion" value="${pom.currentVersion}"/>
</j:otherwise>
</j:choose>
<util:tokenize var="versionItems" delim="." trim="true">${pomCurrentVersion}</util:tokenize>
<j:if test="${size(versionItems) > 0}">
<j:set var="specificationVersion" value="${versionItems[0]}" />
</j:if>
<j:if test="${size(versionItems) > 1}">
<j:set var="specificationVersion" value="${specificationVersion}.${versionItems[1]}" />
</j:if>
<j:if test="${size(versionItems) > 2}">
<j:set var="specificationVersion" value="${specificationVersion}.${versionItems[2]}" />
</j:if>
<ant:attribute name="Specification-Title" value="${specificationTitle}"/>
<ant:attribute name="Specification-Vendor" value="${pom.organization.name}"/>
<ant:attribute name="Specification-Version" value="${specificationVersion}"/>
<ant:attribute name="Implementation-Title" value="${pom.package}"/>
<ant:attribute name="Implementation-Vendor" value="${pom.organization.name}"/>
<ant:attribute name="Implementation-Version" value="${pom.currentVersion}"/>
</ant:manifest>
</ant:jar>

View File

@@ -85,5 +85,15 @@
<timezone>-3</timezone>
</developer>
</developers>
<dependencies/>
<dependencies>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.0</version>
<url>http://jakarta.apache.org/commons/lang/</url>
<properties>
<comment>This library is already loaded by maven's core. Be careful to use the same version number as in the core.</comment>
</properties>
</dependency>
</dependencies>
</project>

View File

@@ -25,6 +25,7 @@
</properties>
<body>
<release version="1.6.2-SNAPSHOT" date="in SVN">
<action dev="snicoll" type="fix" issue="MPWAR-47">Specification and Implementation attributes of the manifest are now defined as main attributes.</action>
<action dev="snicoll" type="add" issue="MPWAR-43">Aded the ability to customize the Class-Path entry of the manifest</action>
<action dev="snicoll" type="update" issue="MPWAR-49">Added property <code>maven.war.resources.overwrite</code> to control is resources overwrites the ones in the generated webapp directory.</action>
<action dev="snicoll" type="update" issue="MPWAR-37" due-to="Troy Poppe">Added ability to expand properties when copying war resources.</action>