maven-plugins/java/plugin.jelly
jstrachan 98525aa613 Defaulted the compile target to 1.1. If a build is done on JDK 1.4 then it defaults to JDK 1.4, which means on some JVM's (e.g. IBM's JDK 1.3) the code won't work! Even if you're not using any JDK 1.4 features. The generated bytecode can contain some JDK 1.4 specific methods!
So as a safety measure, I've defaulted the target to 1.1 by default (which is the default setting for JDK 1.1, 1.2 and 1.3 anyway). 

You can still overload this value on a project by project basis - this just prevents this possible bug hitting Maven users.


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@113388 13f79535-47bb-0310-9956-ffa450edef68
2003-04-26 09:56:23 +00:00

133 lines
4.8 KiB
XML

<?xml version="1.0"?>
<project
xmlns:j="jelly:core"
xmlns:ant="jelly:ant"
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">
<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>
</project>