michal 2003/07/02 03:34:48
Modified: src/plugins-build/war plugin.jelly plugin.properties
src/plugins-build/war/xdocs changes.xml properties.xml
goals.xml
Log:
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
Revision Changes Path
1.22 +27 -52 maven/src/plugins-build/war/plugin.jelly
Index: plugin.jelly
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/war/plugin.jelly,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- plugin.jelly 1 Jul 2003 14:58:52 -0000 1.21
+++ plugin.jelly 2 Jul 2003 10:34:48 -0000 1.22
@@ -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}">
1.3 +1 -0 maven/src/plugins-build/war/plugin.properties
Index: plugin.properties
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/war/plugin.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- plugin.properties 21 Mar 2003 01:26:29 -0000 1.2
+++ plugin.properties 2 Jul 2003 10:34:48 -0000 1.3
@@ -18,3 +18,4 @@
# 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
1.7 +11 -0 maven/src/plugins-build/war/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/war/xdocs/changes.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- changes.xml 1 Jul 2003 14:58:52 -0000 1.6
+++ changes.xml 2 Jul 2003 10:34:48 -0000 1.7
@@ -9,6 +9,17 @@
<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
was slightly changed and now
1.3 +44 -5 maven/src/plugins-build/war/xdocs/properties.xml
Index: properties.xml
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/war/xdocs/properties.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- properties.xml 21 Mar 2003 01:26:29 -0000 1.2
+++ properties.xml 2 Jul 2003 10:34:48 -0000 1.3
@@ -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>
1.3 +22 -11 maven/src/plugins-build/war/xdocs/goals.xml
Index: goals.xml
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/war/xdocs/goals.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- goals.xml 1 Jul 2003 14:58:52 -0000 1.2
+++ goals.xml 2 Jul 2003 10:34:48 -0000 1.3
@@ -9,13 +9,32 @@
<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>
</goal>
@@ -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>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]