war:war goal is simply packaging (using ant jar task) the directory created by war:webapp goal.
This change simplifies the customization of processing and removes code duplication. Fix for Maven-481 - tlds deps can be bundled in wars git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113573 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -33,51 +33,16 @@
|
||||
<!--==================================================================-->
|
||||
<!-- Builds a war file -->
|
||||
<!--==================================================================-->
|
||||
<goal name="war:war" prereqs="war:init" description="Build a war file">
|
||||
<goal name="war:war" prereqs="war:webapp" description="Build a war file">
|
||||
|
||||
<ant:echo>Building WAR ${pom.artifactId}</ant:echo>
|
||||
|
||||
<ant:mkdir dir="${maven.war.build.dir}" />
|
||||
<ant:war warfile="${maven.war.build.dir}/${maven.war.final.name}"
|
||||
webxml="${maven.war.webxml}" update="true">
|
||||
|
||||
<j:if test="${webSourcesPresent == 'true'}">
|
||||
<ant:fileset dir="${maven.war.src}">
|
||||
<ant:exclude name="WEB-INF/web.xml"/>
|
||||
<ant:exclude name="WEB-INF/classes/**/*.class"/>
|
||||
<ant:exclude name="WEB-INF/lib/*.jar"/>
|
||||
</ant:fileset>
|
||||
</j:if>
|
||||
|
||||
<j:forEach var="lib" items="${pom.artifacts}">
|
||||
<j:set var="dep" value="${lib.dependency}"/>
|
||||
<j:set var="bundle" value="false"/>
|
||||
<j:if test="${dep.getProperty('war.bundle.jar')=='true'}">
|
||||
<ant:echo>
|
||||
DEPRECATION WARNING:
|
||||
Use : war.bundle instead of war.bundle.jar
|
||||
</ant:echo>
|
||||
<j:set var="bundle" value="true"/>
|
||||
</j:if>
|
||||
<j:if test="${dep.getProperty('war.bundle')=='true' and dep.type =='jar'}">
|
||||
<j:set var="bundle" value="true"/>
|
||||
</j:if>
|
||||
<j:if test="${bundle == 'true'}">
|
||||
<ant:lib dir="${lib.file.parent}">
|
||||
<ant:include name="${lib.file.name}"/>
|
||||
</ant:lib>
|
||||
</j:if>
|
||||
</j:forEach>
|
||||
|
||||
<j:if test="${sourcesPresent == 'true'}">
|
||||
<ant:classes
|
||||
dir="${maven.build.dest}"
|
||||
include="${maven.war.classes.includes}"
|
||||
exclude="${maven.war.classes.excludes}"/>
|
||||
</j:if>
|
||||
|
||||
<j:set var="licenseFileName"><license:fileName/></j:set>
|
||||
<util:file name="${licenseFileName}" var="licenseFile"/>
|
||||
<ant:jar
|
||||
destfile="${maven.war.build.dir}/${maven.war.final.name}"
|
||||
basedir="${maven.war.webapp.dir}"
|
||||
update="true"
|
||||
index="true">
|
||||
<ant:metainf dir="${licenseFile.canonicalFile.parent}">
|
||||
<ant:include name="${licenseFile.canonicalFile.name}"/>
|
||||
</ant:metainf>
|
||||
@@ -99,7 +64,7 @@
|
||||
</ant:section>
|
||||
</ant:manifest>
|
||||
|
||||
</ant:war>
|
||||
</ant:jar>
|
||||
|
||||
</goal>
|
||||
|
||||
@@ -113,13 +78,16 @@
|
||||
|
||||
<ant:mkdir dir="${maven.war.webapp.dir}"/>
|
||||
|
||||
<ant:property name="webapp.build.webinf" value="${maven.war.webapp.dir}/WEB-INF"/>
|
||||
<j:set var="webapp.build.webinf" value="${maven.war.webapp.dir}/WEB-INF"/>
|
||||
<ant:mkdir dir="${webapp.build.webinf}"/>
|
||||
|
||||
<ant:property name="webapp.build.lib" value="${webapp.build.webinf}/lib"/>
|
||||
<j:set var="webapp.build.lib" value="${webapp.build.webinf}/lib"/>
|
||||
<ant:mkdir dir="${webapp.build.lib}"/>
|
||||
|
||||
<ant:property name="webapp.build.classes" value="${webapp.build.webinf}/classes"/>
|
||||
|
||||
<j:set var="webapp.build.tlds" value="${maven.war.src}/${maven.war.tld.dir}"/>
|
||||
<ant:mkdir dir="${webapp.build.tlds}"/>
|
||||
|
||||
<j:set var="webapp.build.classes" value="${webapp.build.webinf}/classes"/>
|
||||
<ant:mkdir dir="${webapp.build.classes}"/>
|
||||
|
||||
<j:if test="${webSourcesPresent == 'true'}">
|
||||
@@ -128,22 +96,29 @@
|
||||
</ant:copy>
|
||||
</j:if>
|
||||
|
||||
|
||||
|
||||
<j:forEach var="lib" items="${pom.artifacts}">
|
||||
<j:set var="dep" value="${lib.dependency}"/>
|
||||
<j:if test="${dep.getProperty('war.bundle')=='true' and dep.type =='jar' }">
|
||||
<ant:copy todir="${webapp.build.lib}"
|
||||
file="${lib.path}"/>
|
||||
<j:if test="${dep.getProperty('war.bundle')=='true'}">
|
||||
|
||||
<j:if test="${dep.type =='jar'}">
|
||||
<ant:copy todir="${webapp.build.lib}" file="${lib.path}"/>
|
||||
</j:if>
|
||||
|
||||
<j:if test="${dep.type =='tld'}">
|
||||
<ant:copy todir="${webapp.build.tlds}" file="${lib.path}"/>
|
||||
</j:if>
|
||||
|
||||
</j:if>
|
||||
<!-- TO BE REMOVED -->
|
||||
<j:if test="${dep.getProperty('war.bundle.jar')=='true'}">
|
||||
<ant:echo>
|
||||
DEPRECATION WARNING:
|
||||
Use : war.bundle instead of war.bundle.jar
|
||||
</ant:echo>
|
||||
<ant:copy todir="${webapp.build.lib}"
|
||||
file="${lib.path}"/>
|
||||
<ant:copy todir="${webapp.build.lib}" file="${lib.path}"/>
|
||||
</j:if>
|
||||
<!-- END OF TO BE REMOVED -->
|
||||
</j:forEach>
|
||||
|
||||
<ant:copy todir="${webapp.build.classes}">
|
||||
|
||||
@@ -18,3 +18,4 @@ maven.war.build.dir = ${maven.build.dir}
|
||||
# Location where the webapp will be created. Defaults to
|
||||
# ${maven.war.build.dir}/${pom.artifactId}
|
||||
maven.war.webapp.dir = ${maven.war.build.dir}/${pom.artifactId}
|
||||
maven.war.tld.dir=WEB-INF/tld
|
||||
|
||||
@@ -8,6 +8,17 @@
|
||||
<body>
|
||||
|
||||
<release version="1.4" date="in CVS">
|
||||
<action dev="michal" type="fix">
|
||||
war:war goal is simply packaging
|
||||
(using ant jar task) the directory created
|
||||
by war:webapp goal. This change simplifies
|
||||
the customization of processing
|
||||
and removes code duplication.
|
||||
</action>
|
||||
<action dev="michal" type="fix">
|
||||
Fixes for MAVEN-481.
|
||||
Bundling of tlds in war is supported.
|
||||
</action>
|
||||
<action dev="michal" type="fix">
|
||||
Fixes for MAVEN-518.
|
||||
Artifact processing in the plugin
|
||||
|
||||
@@ -9,12 +9,31 @@
|
||||
<goals>
|
||||
<goal>
|
||||
<name>war</name>
|
||||
<description>Build a war file</description>
|
||||
<description>
|
||||
Build a war file.
|
||||
This goal simply executes the <a href="war:war">war:war</a> goal
|
||||
</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>war:init</name>
|
||||
<description>Initialize the file system and attain any necessary goals</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>war:war</name>
|
||||
<description>
|
||||
Build a war file.
|
||||
<br/>
|
||||
This goal simply package the directory created
|
||||
by war:webapp goal. Additional custome content which should be included
|
||||
in the archive can be provided using:
|
||||
<br/>
|
||||
<code><postGoal name="war:webapp"></code>
|
||||
</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>war:webapp</name>
|
||||
<description>Build a webapp directory</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>war:install</name>
|
||||
<description>Install the war in the local repository</description>
|
||||
@@ -30,15 +49,7 @@
|
||||
<goal>
|
||||
<name>war:deploy-snapshot</name>
|
||||
<description>Deploy the snapshot version of the war to the remote repository(ies)</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>war:war</name>
|
||||
<description>Build a war file</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>war:webapp</name>
|
||||
<description>Build a webapp directory</description>
|
||||
</goal>
|
||||
</goals>
|
||||
</goal>
|
||||
</goals>
|
||||
</body>
|
||||
</document>
|
||||
@@ -62,25 +62,64 @@
|
||||
<code>${maven.war.build.dir}/${pom.artifactId}</code>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<a id="tld_dir"/>
|
||||
<td>maven.war.tld.dir</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
Subdirectory of web application context root directory
|
||||
where tag library descriptors (tld files) will be copied.
|
||||
Maven WAR Plugin copies to this location all dependencies
|
||||
(specified in the POM) of the
|
||||
type <code>"tld"</code> and marked with special meta-information.
|
||||
See the section below for more information.
|
||||
<br/>
|
||||
It defaults to
|
||||
<code>WEB-INF/tld</code>.
|
||||
This setting is adhering to
|
||||
<a href="http://developer.java.sun.com/developer/technicalArticles/javaserverpages/code_convention/"
|
||||
>SUN Code Conventions for the JavaServer Pages</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
<section name="Including Jars in the Webapp">
|
||||
<section name="Including artifact in the Webapp">
|
||||
<p>
|
||||
You must tell Maven what jars you want included in the Webapp. This
|
||||
You must tell Maven what artifact you want included in the Webapp. This
|
||||
is achieved by specifying meta-information in the POM, using the
|
||||
following syntax:
|
||||
</p>
|
||||
|
||||
<source><![CDATA[
|
||||
<dependency>
|
||||
<id>jarid</id>
|
||||
<groupId>grpId</groupId>
|
||||
<artifactId>jarid</artifactId>
|
||||
<version>jarversion</version>
|
||||
<type>jar</type>
|
||||
<properties>
|
||||
<war.bundle.jar>true</war.bundle.jar>
|
||||
<war.bundle>true</war.bundle>
|
||||
</properties>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>grpId</groupId>
|
||||
<artifactId>tldid</artifactId>
|
||||
<version>tldversion</version>
|
||||
<type>tld</type>
|
||||
<properties>
|
||||
<war.bundle>true</war.bundle>
|
||||
</properties>
|
||||
</dependency>
|
||||
]]></source>
|
||||
|
||||
|
||||
<p>
|
||||
This process in type senstive.
|
||||
Currently following types are supported:
|
||||
<ol>
|
||||
<li>jar</li>
|
||||
<li>tld (see: <a href="#tld_dir">maven.war.tld.dir</a>)</li>
|
||||
</ol>
|
||||
</p>
|
||||
</section>
|
||||
</body>
|
||||
</document>
|
||||
|
||||
Reference in New Issue
Block a user