blob: 17f645b2c07fef268d8fad65f2ca39994a4352ab [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.
-->
<project xmlns:ivy="antlib:org.apache.ivy.ant">
<import file="ivy-common.xml"/>
<property name="project.lib.dir" location="${project.webapp.dir}/WEB-INF/lib" />
<property name="project.core.src.dir" location="src" />
<property name="project.test.src.dir" location="src-tests" />
<property name="project.build.classes.dir" location="${project.build.dir}/classes" />
<property name="project.build.classes.test.dir" location="${project.build.dir}/classes-test" />
<property name="compile.debug" value="on" />
<property name="jvmargs" value="" />
<property name="compilerargs" value="" />
<property name="jdbc.driver.path" value="" />
<property name="dist.dir" location="dist"/>
<property name="java.source.version" value="1.5"/>
<property name="java.target.version" value="1.5"/>
<target name="init">
<available file="${project.core.src.dir}" property="project.core.src.dir.exists"/>
<available file="${project.test.src.dir}" property="project.test.src.dir.exists"/>
<ivy:cachepath pathid="project.core.class.path" conf="dev" />
<ivy:cachepath pathid="project.test.class.path" conf="test" />
<path id="run.path.id">
<path refid="project.core.class.path" />
<path location="${project.build.classes.dir}" />
<path location="${jdbc.driver.path}" />
</path>
<propertyset id="run.syspropertyset.id">
<propertyref prefix="${ant.project.name}."/>
</propertyset>
</target>
<target name="compile-test"
depends="compile-core" description="--> compile the project tests"
if="project.test.src.dir.exists">
<echo>Compiling test files in ${project.test.src.dir}</echo>
<mkdir dir="${project.build.classes.test.dir}" />
<javac source="${java.source.version}"
target="${java.target.version}"
destdir="${project.build.classes.test.dir}"
debug="${compile.debug}">
<src path="${project.test.src.dir}" />
<classpath>
<path refid="project.test.class.path" />
<path location="${project.build.classes.dir}" />
</classpath>
</javac>
<echo>Copying resources from test source directory</echo>
<copy todir="${project.build.classes.test.dir}">
<fileset dir="${project.test.src.dir}">
<exclude name="**.java" />
</fileset>
</copy>
<antcall target="post-compile-test" inheritRefs="true"/>
</target>
<target name="post-compile-test" description="Run after compile-test. Intended to be overridden if your project needs any post compile processing"/>
<target name="local-publish-subprojects" description="Build all sub-projects of this project and deploy them locally.">
<echo>No sub-projects of ${ant.project.name}-${version} to publish.</echo>
</target>
<target name="compile-core"
depends="local-publish-subprojects, resolve, init" description="--> compile the project"
if="project.core.src.dir.exists">
<echo>Preparing to compile core of ${ant.project.name}-${version}.</echo>
<antcall target="pre-compile-core" inheritRefs="true"/>
<echo>Compiling files in ${project.core.src.dir}</echo>
<echo>Build directory is ${project.build.classes.dir}</echo>
<mkdir dir="${project.build.classes.dir}" />
<echo>Compile core of ${ant.project.name}-${version}.</echo>
<javac
source="${java.source.version}"
target="${java.target.version}"
destdir="${project.build.classes.dir}"
debug="${compile.debug}"
classpathref="project.core.class.path">
<src path="${project.core.src.dir}" />
<compilerarg line="${compilerargs}" />
</javac>
<echo>Copying resources from source directory</echo>
<copy todir="${project.build.classes.dir}">
<fileset dir="${project.core.src.dir}">
<exclude name="**.java" />
</fileset>
</copy>
<antcall target="post-compile-core" inheritRefs="true"/>
</target>
<target name="pre-compile-core" description="Run before compile-core. intended to be overridden if your project needs any post compile processing"/>
<target name="post-compile-core" description="Run after compile-core. Intended to be overridden if your project needs any post compile processing"/>
<target name="run" depends="compile-core" description="--> compile and run the project">
<java classname="${main.start.class.name}"
classpathref="run.path.id"
fork="true"
failonerror="true">
<jvmarg line="${jvmargs}"/>
<arg line="${run.args}"/>
<syspropertyset refid="run.syspropertyset.id"/>
</java>
</target>
<target name="stopserver" depends="init" description="--> stop the running server instance">
<java classname="${main.stop.class.name}"
classpathref="run.path.id"
fork="true"
failonerror="true">
<jvmarg line="${jvmargs}"/>
<arg line="${run.args}"/>
<syspropertyset refid="run.syspropertyset.id"/>
</java>
</target>
<target name="jar" depends="clean-dist, compile-core" description="--> make a jar file for this project">
<mkdir dir="${dist.dir}"/>
<copy file="../../LICENSE" tofile="${project.build.classes.dir}/LICENSE" overwrite="yes" />
<copy file="../../NOTICE" tofile="${project.build.classes.dir}/NOTICE" overwrite="yes" />
<copy file="../../DISCLAIMER" tofile="${project.build.classes.dir}/DISCLAIMER" overwrite="yes" />
<jar destfile="${dist.dir}/${ant.project.name}-${version}.jar">
<fileset dir="${project.build.classes.dir}"/>
</jar>
</target>
<target name="publish" depends="clean-build, jar" description="--> publish this project in the ivy repository">
<ivy:publish
artifactspattern="[artifact].[ext]"
resolver="shared"
pubrevision="${version}"
/>
<echo message="project ${ant.project.name} released with version ${revision}" />
</target>
<target name="publish-local" depends="clean-dist, jar" description="--> publish this project in the local ivy repository">
<echo>Locally publishing ${ant.project.name}-${version}</echo>
<delete file="${dist.dir}/ivy.xml"/> <!-- delete last produced ivy file to be sure a new one will be generated -->
<tstamp>
<format property="now" pattern="yyyyMMddHHmmss"/>
</tstamp>
<ivy:makepom ivyfile="${basedir}/ivy.xml" pomfile="${dist.dir}/${ant.project.name}.pom"/>
<ivy:publish resolver="local"
pubrevision="${version}"
forcedeliver="true"
srcivypattern="${dist.dir}/ivy.xml"
pubdate="${now}"
overwrite="true">
<artifact name="${ant.project.name}" type="pom" ext="pom"/>
<artifacts pattern="${dist.dir}/${ant.project.name}-${version}.jar"/>
</ivy:publish>
<echo message="project ${ant.project.name} published locally with version ${version}" />
</target>
</project>