blob: 37758ba9a9b17de0eeb5931afdfc631bae94a2af [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!-- ======================================================================== -->
<!-- -->
<!-- maven Buildfile -->
<!-- -->
<!-- $Id$ -->
<!-- -->
<!-- ======================================================================== -->
<project
xmlns:j="jelly:core"
xmlns:u="jelly:util"
xmlns:maven="jelly:maven"
xmlns:ant="jelly:ant"
default="jar:jar">
<!-- ================================================================== -->
<!-- C O M P I L E P R E - G O A L -->
<!-- ================================================================== -->
<!-- Before compiling the Source Code, it is necessary to -->
<!-- replace a few tokens in the source code. -->
<!-- ================================================================== -->
<preGoal name="java:compile">
<ant:tstamp>
<ant:format property="build.time" pattern="yyyy-MM-dd HH:mm:ss" />
<ant:format property="build.year" pattern="yyyy"/>
</ant:tstamp>
<ant:filter token="build.year" value="${build.year}"/>
<ant:filter token="build.version" value="${pom.currentVersion}"/>
<ant:filter token="build.time" value="${build.time}"/>
<ant:copy todir="target/src" filtering="yes">
<ant:fileset dir="src/java">
<ant:include name="**/*.java"/>
</ant:fileset>
</ant:copy>
<!-- Hack for Maven bug when compiling with a clean target. -->
<j:if test="${sourcesPresent != 'true'}">
<j:set var="sourcesPresent" value="true"/>
<path id="maven.compile.src.set" location="target/src"/>
</j:if>
</preGoal>
<!-- ================================================================== -->
<!-- T E S T - C O M P I L E P R E - G O A L -->
<!-- ================================================================== -->
<!-- The test code is used by the ant and the maven build but both use -->
<!-- different directories controlled by ant tokens. Replace these -->
<!-- with the correct values. -->
<!-- ================================================================== -->
<preGoal name="test:compile">
<ant:filter token="test.dir" value="./test"/>
<ant:filter token="build.test" value="target/test"/>
<ant:copy todir="target/test-src" filtering="yes">
<ant:fileset dir="src/test">
<ant:include name="**/*.java"/>
</ant:fileset>
</ant:copy>
<!-- Hack for Maven bug when compiling with a clean target. -->
<j:if test="${unitTestSourcesPresent != 'true'}">
<j:set var="unitTestSourcesPresent" value="true"/>
<path id="maven.test.compile.src.set" location="target/test-src"/>
</j:if>
</preGoal>
<!-- ================================================================== -->
<!-- T E S T - R E S O U R C E S P R E - G O A L -->
<!-- ================================================================== -->
<!-- The ClasspathResourceTestCase, TexenTestCase and AnakiaTestCase -->
<!-- require that some prerequisites are run before the actual test -->
<!-- cases (which compare only outputs) are executed. -->
<!-- ================================================================== -->
<preGoal name="test:test-resources">
<attainGoal name="anakiaTest"/>
<attainGoal name="texenTest"/>
<attainGoal name="texenClasspathTest"/>
</preGoal>
<!-- Initialize the anakia and texen tasks for use from maven -->
<goal name="init-tasks">
<path id="velocity-classpath">
<pathelement location="${maven.test.dest}"/>
<pathelement location="${maven.build.dest}"/>
<path refid="maven.dependency.classpath"/>
</path>
<taskdef name="texen" classname="org.apache.velocity.texen.ant.TexenTask">
<classpath>
<path refid="velocity-classpath"/>
</classpath>
</taskdef>
<taskdef name="texen-classpath" classname="org.apache.velocity.texen.ant.TexenTask">
<classpath>
<path refid="velocity-classpath"/>
<pathelement location="${basedir}/test/texen-classpath/test.jar"/>
</classpath>
</taskdef>
<taskdef name="anakia" classname="org.apache.velocity.anakia.AnakiaTask">
<classpath>
<path refid="velocity-classpath"/>
</classpath>
</taskdef>
</goal>
<!-- TexenTestCase -->
<goal name="texenTest"
prereqs="init-tasks">
<texen
contextProperties="${basedir}/test/texen/service.props,test/texen/additional.props"
controlTemplate="Control.vm"
outputDirectory="${maven.build.dir}/test/texen"
templatePath="${basedir}/test/texen/templates"
outputFile="report"
/>
</goal>
<!-- TexenClasspathTestCase -->
<goal name="texenClasspathTest"
prereqs="init-tasks">
<texen-classpath
useClassPath="true"
contextProperties="service.props"
controlTemplate="Control.vm"
outputDirectory="${basedir}/target/test/texen-classpath"
outputFile="report"
/>
</goal>
<!-- AnakiaTestCase -->
<goal name="anakiaTest"
prereqs="init-tasks">
<anakia basedir="test/anakia/xdocs" destdir="target/test/anakia"
extension=".html" style="site.vsl"
projectFile="stylesheets/project.xml"
excludes="**/stylesheets/**"
includes="**/*.xml"
templatePath="test/anakia/xdocs/stylesheets"
velocityPropertiesFile="test/anakia/velocity.properties"
lastModifiedCheck="false">
</anakia>
<anakia basedir="test/anakia/xdocs"
destdir="target/test/anakia"
extension=".context.html" style="site_contexts.vsl"
projectFile="stylesheets/project.xml"
excludes="**/stylesheets/**"
includes="**/*.xml"
templatePath="test/anakia/xdocs/stylesheets"
lastModifiedCheck="false">
<context name="customContext" file="stylesheets/customContext.xml"/>
</anakia>
</goal>
<!-- MultiLoader Test wants to load the contents of this jar from the
classpath. As we can't manipulate the class path for the junit tests, we
have to unjar the test jar in the test-classes directory.
See http://jira.codehaus.org/browse/MPTEST-57
-->
<postGoal name="test:test-resources">
<unjar src="test/cpload/test1.jar" dest="target/test-classes" />
</postGoal>
</project>