maven-plugins/java/plugin.jelly

140 lines
5.1 KiB
XML

<?xml version="1.0"?>
<project
xmlns:j="jelly:core"
xmlns:ant="jelly:ant"
xmlns:define="jelly:define"
xmlns:resources="resources">
<j:choose>
<j:when test="${!pom.build.resources.includes.isEmpty()}">
<ant:property name="maven.has.jar.resource.patterns" value="true"/>
</j:when>
<j:when test="${!pom.build.resources.excludes.isEmpty()}">
<ant:property name="maven.has.jar.resource.patterns" value="true"/>
</j:when>
<j:otherwise>
<ant:property name="maven.has.jar.resource.patterns" value="false"/>
</j:otherwise>
</j:choose>
<ant:patternset id="maven.jar.resources.set">
<j:forEach var="res" items="${pom.build.resources.includes}">
<ant:include name="${res}"/>
</j:forEach>
<j:forEach var="res" items="${pom.build.resources.excludes}">
<ant:exclude name="${res}"/>
</j:forEach>
</ant:patternset>
<!-- ================================================================== -->
<!-- P R E P A R E F I L E S Y S T E M -->
<!-- ================================================================== -->
<goal name="java:prepare-filesystem"
description="Create the directory structure needed to compile">
<ant:mkdir dir="${maven.build.dest}"/>
</goal>
<!-- ================================================================== -->
<!-- C O M P I L E -->
<!-- ================================================================== -->
<goal name="java:compile"
description="Compile the project"
prereqs="java:prepare-filesystem">
<echo>Compiling to ${maven.build.dest}</echo>
<j:choose>
<j:when test="${sourcesPresent == 'true'}">
<ant:javac
destdir="${maven.build.dest}"
excludes="**/package.html"
debug="${maven.compile.debug}"
deprecation="${maven.compile.deprecation}"
target="${maven.compile.target}"
optimize="${maven.compile.optimize}">
<ant:src>
<ant:path refid="maven.compile.src.set"/>
</ant:src>
<!--
|
| Source Modifications.
|
-->
<j:forEach var="sm" items="${pom.build.sourceModifications}">
<ant:available property="classPresent" classname="${sm.className}"/>
<j:if test="${classPresent != 'true'}">
<j:forEach var="exclude" items="${sm.excludes}">
<ant:exclude name="${exclude}"/>
</j:forEach>
<j:forEach var="include" items="${sm.includes}">
<ant:include name="${include}"/>
</j:forEach>
</j:if>
</j:forEach>
<ant:classpath>
<ant:path refid="maven.dependency.classpath"/>
<ant:pathelement path="${maven.build.dest}"/>
</ant:classpath>
<j:if test="${context.getVariable('maven.compile.compilerargs') != null}">
<ant:compilerarg line="${maven.compile.compilerargs}" />
</j:if>
<j:if test="${context.getVariable('maven.compile.encoding') != null}">
<ant:setProperty name="encoding" value="${maven.compile.encoding}" />
</j:if>
<j:if test="${context.getVariable('maven.compile.executable') != null}">
<ant:setProperty name="executable" value="${maven.compile.executable}" />
</j:if>
<j:if test="${context.getVariable('maven.compile.fork') != null}">
<ant:setProperty name="fork" value="${maven.compile.fork}" />
</j:if>
<j:if test="${context.getVariable('maven.compile.source') != null}">
<ant:setProperty name="source" value="${maven.compile.source}" />
</j:if>
<j:if test="${context.getVariable('maven.compile.verbose') != null}">
<ant:setProperty name="verbose" value="${maven.compile.verbose}" />
</j:if>
</ant:javac>
</j:when>
<j:otherwise>
<ant:echo>No java source files to compile.</ant:echo>
</j:otherwise>
</j:choose>
</goal>
<goal name="java:jar"
description="Create the deliverable jar file."
prereqs="jar:jar">
<echo>java:jar is deprecated and will be removed. Please use jar:jar</echo>
</goal>
<!-- ================================================================== -->
<!-- J A R R E S O U R C E S -->
<!-- ================================================================== -->
<goal name="java:jar-resources"
description="Copy any resources that must be present in the deployed JAR file">
<j:if test="${!pom.build.resources.isEmpty()}">
<resources:copy
resources="${pom.build.resources}"
todir="${maven.build.dest}"
/>
</j:if>
</goal>
<define:taglib uri="java">
<define:tag name="dependency-handle">
<!-- XXX Use this tag to allow this plugin to be loaded into another -->
</define:tag>
</define:taglib>
</project>