maven-plugins/war/plugin.jelly
vmassol 9f51cc2e43 fix comment
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113521 13f79535-47bb-0310-9956-ffa450edef68
2003-06-19 14:01:51 +00:00

217 lines
8.3 KiB
XML

<?xml version="1.0"?>
<project xmlns:j="jelly:core"
xmlns:license="license"
xmlns:util="jelly:util"
xmlns:ant="jelly:ant"
xmlns:artifact="artifact">
<!--==================================================================-->
<!-- 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">
<ant:available property="webSourcesPresent" type="dir"
file="${maven.war.src}"/>
<j:if test="${sourcesPresent == 'true'}">
<attainGoal name="java:compile"/>
<attainGoal name="test:test"/>
</j:if>
<ant:property name="maven.war.final.name"
value="${pom.artifactId}.war"/>
</goal>
<!--==================================================================-->
<!-- Builds a war file -->
<!--==================================================================-->
<goal name="war:war" prereqs="war:init" 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="dep" items="${pom.dependencies}">
<j:if test="${dep.getProperty('war.bundle.jar')=='true'}">
<ant:echo>
DEPRECATION WARNING:
Use : war.bundle instead of war.bundle.jar
</ant:echo>
<ant:lib dir="${maven.repo.local}/${dep.artifactDirectory}/jars/">
<ant:include name="${dep.artifact}"/>
</ant:lib>
</j:if>
<j:if test="${dep.getProperty('war.bundle')=='true' and dep.type =='jar' }">
<ant:lib dir="${maven.repo.local}/${dep.artifactDirectory}/jars/">
<ant:include name="${dep.artifact}"/>
</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:metainf dir="${licenseFile.canonicalFile.parent}">
<ant:include name="${licenseFile.canonicalFile.name}"/>
</ant:metainf>
<ant:manifest>
<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>
</ant:manifest>
</ant:war>
</goal>
<!--==================================================================-->
<!-- Builds an expanded webapp -->
<!--==================================================================-->
<goal name="war:webapp" prereqs="war:init"
description="Build a webapp directory">
<ant:echo>Assembling webapp ${pom.artifactId}</ant:echo>
<ant:mkdir dir="${maven.war.webapp.dir}"/>
<ant:property name="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"/>
<ant:mkdir dir="${webapp.build.lib}"/>
<ant:property name="webapp.build.classes" value="${webapp.build.webinf}/classes"/>
<ant:mkdir dir="${webapp.build.classes}"/>
<j:if test="${webSourcesPresent == 'true'}">
<ant:copy todir="${maven.war.webapp.dir}">
<ant:fileset dir="${maven.war.src}"/>
</ant:copy>
</j:if>
<j:forEach var="dep" items="${pom.dependencies}">
<j:if test="${dep.getProperty('war.bundle')=='true' and dep.type =='jar' }">
<ant:copy todir="${webapp.build.lib}"
file="${maven.repo.local}/${dep.artifactDirectory}/jars/${dep.artifact}"/>
</j:if>
<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="${maven.repo.local}/${dep.artifactDirectory}/jars/${dep.artifact}"/>
</j:if>
</j:forEach>
<ant:copy todir="${webapp.build.classes}">
<ant:fileset dir="${maven.build.dest}">
<ant:include name="${maven.war.classes.includes}" />
<ant:exclude name="${maven.war.classes.excludes}" />
</ant:fileset>
</ant:copy>
</goal>
<!--==================================================================-->
<!-- Install the war in the local repository -->
<!--==================================================================-->
<goal name="war:install"
prereqs="war:war"
description="Install the war in the local repository">
<artifact:install
artifact="${maven.war.build.dir}/${maven.war.final.name}"
type="war"
project="${pom}"/>
</goal>
<!--==================================================================-->
<!-- Install the snapshot version of the war in the local repository -->
<!--==================================================================-->
<goal name="war:install-snapshot"
prereqs="war:war"
description="Install the snapshot version of the war in the local repository">
<artifact:install-snapshot
artifact="${maven.war.build.dir}/${maven.war.final.name}"
type="war"
project="${pom}"/>
</goal>
<!--==================================================================-->
<!-- Deploys the war to the remote repository -->
<!--==================================================================-->
<goal name="war:deploy"
prereqs="war:war"
description="Deploys the war to the remote repository">
<artifact:deploy
artifact="${maven.war.build.dir}/${maven.war.final.name}"
type="war"
project="${pom}"/>
</goal>
<!--==================================================================-->
<!-- Deploys the snapshot of the war to the remote repository -->
<!--==================================================================-->
<goal name="war:deploy-snapshot"
prereqs="war:war"
description="Deploys the snapshot version of the war to remote repository">
<artifact:deploy-snapshot
artifact="${maven.war.build.dir}/${maven.war.final.name}"
type="war"
project="${pom}"/>
</goal>
<!--==================================================================-->
<!-- Special no-op goal which can be used by other plugin which need -->
<!-- to get access to any of this plugin's property. This is -->
<!-- temporary, until we get explicit plugin dependencies. -->
<!--==================================================================-->
<goal name="war:load"/>
</project>