maven-plugins/war/plugin.jelly
evenisse 511a4fb389 correction of MAVEN-278.
Thanks to  Henning Schmiedehausen .


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@112944 13f79535-47bb-0310-9956-ffa450edef68
2003-02-17 17:31:35 +00:00

148 lines
5.4 KiB
XML

<?xml version="1.0"?>
<project xmlns:j="jelly:core"
xmlns:license="license"
xmlns:util="jelly:util">
<!--==================================================================-->
<!-- Default goal : Builds a war file -->
<!--==================================================================-->
<goal name="war" prereqs="war:war" description="Build a war file"/>
<!--==================================================================-->
<!-- Initializations -->
<!--==================================================================-->
<goal name="war:init"
description="Initialize the file system and attain any necessary goals">
<available property="webSourcesPresent" type="dir"
file="${maven.war.src}"/>
<j:if test="${sourcesPresent == 'true'}">
<attainGoal name="java:compile"/>
<attainGoal name="test:test"/>
</j:if>
</goal>
<!--==================================================================-->
<!-- Builds a war file -->
<!--==================================================================-->
<goal name="war:war" prereqs="war:init" description="Build a war file">
<property name="maven.war.final.name"
value="${pom.artifactId}.war"/>
<echo>Building WAR ${pom.artifactId}</echo>
<mkdir dir="${maven.war.build.dir}" />
<war warfile="${maven.war.build.dir}/${maven.war.final.name}"
webxml="${maven.war.webxml}">
<j:if test="${webSourcesPresent == 'true'}">
<fileset dir="${maven.war.src}">
<exclude name="WEB-INF/web.xml"/>
</fileset>
</j:if>
<j:forEach var="dep" items="${pom.dependencies}">
<j:if test="${dep.getProperty('war.bundle.jar')=='true'}">
<lib dir="${maven.repo.local}/${dep.artifactDirectory}/jars/">
<include name="${dep.artifact}"/>
</lib>
</j:if>
</j:forEach>
<j:if test="${sourcesPresent == 'true'}">
<classes dir="${maven.build.dest}">
<include name="${maven.war.classes.includes}" />
<exclude name="${maven.war.classes.excludes}" />
</classes>
</j:if>
<j:set var="licenseFileName"><license:fileName/></j:set>
<util:file name="${licenseFileName}" var="licenseFile"/>
<metainf dir="${licenseFile.canonicalFile.parent}">
<include name="${licenseFile.canonicalFile.name}"/>
</metainf>
<manifest>
<attribute name="Built-By" value="${user.name}" />
<section name="${pom.package}">
<attribute name="Specification-Title" value="${pom.artifactId}" />
<attribute name="Specification-Version"
value="${pom.currentVersion}" />
<attribute name="Specification-Vendor"
value="${pom.organization.name}" />
<attribute name="Implementation-Title"
value="${pom.package}" />
<attribute name="Implementation-Version"
value="${pom.currentVersion}" />
<attribute name="Implementation-Vendor"
value="${pom.organization.name}" />
</section>
</manifest>
</war>
</goal>
<!--==================================================================-->
<!-- Builds an expanded webapp -->
<!--==================================================================-->
<goal name="war:webapp" prereqs="war:init"
description="Build a webapp directory">
<echo>Assembling webapp ${pom.artifactId}</echo>
<property name="webapp.build" value="${maven.war.build.dir}/${pom.artifactId}"/>
<mkdir dir="${webapp.build}"/>
<property name="webapp.build.webinf" value="${webapp.build}/WEB-INF"/>
<mkdir dir="${webapp.build.webinf}"/>
<property name="webapp.build.lib" value="${webapp.build.webinf}/lib"/>
<mkdir dir="${webapp.build.lib}"/>
<property name="webapp.build.classes" value="${webapp.build.webinf}/classes"/>
<mkdir dir="${webapp.build.classes}"/>
<j:if test="${webSourcesPresent == 'true'}">
<copy todir="${webapp.build}">
<fileset dir="${maven.war.src}"/>
</copy>
</j:if>
<j:forEach var="dep" items="${pom.dependencies}">
<j:if test="${dep.getProperty('war.bundle.jar')=='true'}">
<copy todir="${webapp.build.lib}"
file="${maven.repo.local}/${dep.artifactDirectory}/jars/${dep.artifact}"/>
</j:if>
</j:forEach>
<copy todir="${webapp.build.classes}">
<fileset dir="${maven.build.dest}">
<include name="${maven.war.classes.includes}" />
<exclude name="${maven.war.classes.excludes}" />
</fileset>
</copy>
</goal>
<!--==================================================================-->
<!-- Install the war in the local repository -->
<!--==================================================================-->
<goal name="war:install"
prereqs="war:war"
description="Install the war in the local repository">
<property name="maven.war.install.dir"
value="${maven.repo.local}/${pom.artifactDirectory}/wars"/>
<mkdir dir="${maven.war.install.dir}"/>
<copy file="${maven.war.build.dir}/${maven.war.final.name}"
tofile="${maven.war.install.dir}/${maven.war.final.name}"/>
</goal>
</project>