o Documented the new property in properties.xml
In some cases it might be different from the war dir, so this allows one to
change it in its project.properties file.
It defaults to ${maven.war.build.dir}/${pom.artifactId}.
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113164 13f79535-47bb-0310-9956-ffa450edef68
147 lines
5.4 KiB
XML
147 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>
|
|
|
|
<mkdir dir="${maven.war.webapp.dir}"/>
|
|
|
|
<property name="webapp.build.webinf" value="${maven.war.webapp.dir}/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="${maven.war.webapp.dir}">
|
|
<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>
|