maven-plugins/uberjar/plugin.jelly
kaz d77f369360 Modifying plugin to use the new plugin-resources directory standard
which gets included automatically by the reactor's pom.


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@112730 13f79535-47bb-0310-9956-ffa450edef68
2003-01-24 21:06:54 +00:00

121 lines
4.0 KiB
XML

<?xml version="1.0"?>
<project xmlns:j="jelly:core"
xmlns:velocity="jelly:org.apache.commons.jelly.tags.velocity.VelocityTagLibrary">
<!--==================================================================-->
<!-- Default goal : Builds a uberjar file -->
<!--==================================================================-->
<goal
name="uberjar"
prereqs="uberjar:uberjar"
description="Build a uberjar file"/>
<!--==================================================================-->
<!-- Initializations -->
<!--==================================================================-->
<goal name="uberjar:init">
<property name="dest" value="target/uberjar"/>
<property name="inf" value="${dest}/WORLDS-INF"/>
<property name="libdir" value="${inf}/lib"/>
<property name="confdir" value="${inf}/conf"/>
<mkdir dir="${libdir}"/>
<mkdir dir="${confdir}"/>
</goal>
<!--==================================================================-->
<!-- Build the uberjar -->
<!--==================================================================-->
<goal
name="uberjar:uberjar"
prereqs="java:jar, uberjar:init"
description="Build an uberjar">
<j:set var="uberconf" value="${maven.uberjar.classworlds.conf}"/>
<!-- Create the classworlds conf if user hasn't specified one -->
<j:choose>
<j:when test="${empty(uberconf)}">
<attainGoal name="uberjar:classworlds-conf"/>
</j:when>
<j:otherwise>
<copy file="${uberconf}" tofile="${confdir}/classworlds.conf"/>
</j:otherwise>
</j:choose>
<!-- Copy the project's complete jar -->
<copy
file="${maven.build.dir}/${maven.final.name}.jar"
todir="${libdir}"/>
<!-- Copy each dep to our working dir -->
<j:forEach var="dep" items="${pom.dependencies}">
<copy
todir="${libdir}"
file="${maven.repo.local}/${dep.artifactDirectory}/jars/${dep.artifact}"/>
</j:forEach>
<!-- Copy the classworlds.jar -->
<copy
tofile="${inf}/classworlds.jar"
file="${plugin.getDependencyPath('classworlds')}"/>
<!-- Unjar the bootstrap code -->
<unjar
dest="${dest}"
src="${plugin.getDependencyPath('classworlds')}">
<patternset>
<include name="com/werken/classworlds/boot/*.class"/>
<include name="com/werken/classworlds/protocol/jar/*.class"/>
</patternset>
</unjar>
<!-- Jar it all up -->
<jar
jarfile="${maven.build.dir}/${maven.final.name}-uber.jar"
basedir="${dest}">
<manifest>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Created-By" value="Classworlds"/>
<attribute name="Package" value="${pom.package}"/>
<attribute name="Main-Class" value="com.werken.classworlds.boot.Bootstrapper"/>
</manifest>
</jar>
</goal>
<!--==================================================================-->
<!-- Generate a classworlds conf file -->
<!--==================================================================-->
<goal
name="uberjar:classworlds-conf"
prereqs="uberjar:init"
description="Generates a classworlds conf">
<j:set var="ubermain" value="${maven.uberjar.main}"/>
<j:if test="${empty(ubermain)}">
<fail message="">
The ubermain property has not been set. This value should
be set to the value of the class that contains the main method
to be invoked.
</fail>
</j:if>
<!-- Need to add the ant property 'maven.final.name' to the context
those are preloaded into the jelly context which is supposed to
happen soon. -->
<j:set var="self" value="${maven.final.name}"/>
<velocity:merge
name="${confdir}/classworlds.conf"
basedir="${plugin.resources}/conf"
template="classworlds.conf"/>
</goal>
</project>