<!--
 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 default="all">

    <import file="../common-build.xml"/>
    
    <target name="clean">
      <delete dir="build"/>
      <delete dir="dist"/>
      <delete dir="test-output"/>
      <delete dir="test-postgresql-output"/>
      <delete dir="test-mysql-output"/>
      <delete dir="test-HSQLDB-output"/>
      <delete dir="test-HSQLDBext-output"/>
      <delete dir="build/tmp"/>
    </target>

    <path id="less-classpath">
        <fileset dir="../lib">
            <include name="less4j*.jar"/>
            <include name="antlr-runtime*.jar"/>
            <include name="commons-beanutils*.jar"/>
            <include name="protobuf-java*.jar"/>
            <include name="commons-io*.jar"/>
            <include name="commons-logging*.jar"/>
        </fileset>
    </path>
    
    <path id="framework-classpath">
        <fileset dir="../lib">
            <include name="zookeeper*.jar"/>
            <include name="netty-handler*.jar"/>
            <include name="metrics-core*.jar" />
            <include name="snappy-java*.jar" />
            <include name="json-simple*.jar"/>
            <include name="commons-codec*.jar"/>
            <include name="commons-collections-*.jar"/>
            <include name="commons-collections4-*.jar"/>
            <include name="commons-el*.jar"/>
            <include name="commons-fileupload2-*.jar"/>
            <include name="jetty-http2-*.jar"/>
            <include name="httpcore*.jar"/>
            <include name="httpclient*.jar"/>
            <include name="httpmime*.jar"/>
            <include name="commons-io*.jar"/>
            <include name="commons-lang*.jar"/>
            <include name="commons-logging*.jar"/>
            <include name="ecj*.jar"/>
            <include name="tomcat-*.jar"/>
            <include name="jetty-*.jar"/>
            <include name="slf4j*.jar"/>
            <include name="log4j-api-*.jar"/>
            <include name="log4j-core-*.jar"/>
            <include name="log4j-1.2-api-*.jar"/>
            <include name="serializer*.jar"/>
            <include name="jakarta.servlet-api*.jar"/>
            <include name="jakarta.el-api*.jar"/>
            <include name="tomcat-*.jar"/>
            <include name="xercesImpl*.jar"/>
            <include name="xml-apis*.jar"/>
            <include name="velocity*.jar"/>
            <include name="jakarta.mail-api*.jar"/>
            <include name="commons-exec*.jar"/>
            <include name="gson*.jar"/>
            <include name="guava*.jar"/>
            <include name="jna*.jar"/>
        </fileset>
        <fileset dir="../lib">
            <include name="jakarta.activation-api*.jar"/>
            <include name="jakarta.xml.bind-api*.jar"/>
            <include name="jakarta.xml.ws-api*.jar"/>
            <include name="jakarta.xml.soap-api*.jar"/>
            <include name="jakarta.annotation-api*.jar"/>
            <include name="jakarta.ws.rs-api*.jar"/>
            <include name="jakarta.jws-api*.jar"/>
            <include name="angus-activation*.jar"/>
        </fileset>
        <fileset dir="../lib">
            <include name="postgresql*.jar"/>
            <include name="hsqldb*.jar"/>
        </fileset>
        <fileset dir="../lib">
            <include name="junit*.jar"/>
            <include name="selenium*.jar"/>
            <include name="okhttp*.jar"/>
            <include name="okio*.jar"/>
            <include name="byte-buddy*.jar"/>
            <include name="cglib-nodep*.jar"/>
            <include name="hamcrest-core*.jar"/>
            <include name="mockito-core*.jar"/>
            <include name="wiremock*.jar"/>
            <include name="objenesis*.jar"/>
        </fileset>
        <fileset dir="../lib-proprietary">
            <include name="mysql*.jar"/>
            <include name="ojdbc*.jar"/>
            <include name="jtds*.jar"/>
            <include name="mariadb-java-client*.jar"/>
        </fileset>

    </path>
    
    <path id="connector-common-classpath">
        <fileset dir="../lib">
            <include name="tika-core*.jar"/>
            <include name="jackson-core*.jar"/>
            <include name="jackson-databind*.jar"/>
            <include name="jackson-annotations*.jar"/>
            <include name="tika-parsers*.jar"/>
            <include name="woodstox-core-5*.jar"/>
            <include name="stax2-api*.jar"/>
            <include name="json-1*.jar"/>
            <include name="geoapi*.jar"/>
            <include name="jsr-275*.jar"/>
            <include name="sis-metadata*.jar"/>
            <include name="sis-utility*.jar"/>
            <include name="sis-netcdf*.jar"/>
            <include name="sis-storage*.jar"/>
            <include name="sis-feature*.jar"/>
            <include name="unit-api*.jar"/>
            <include name="opennlp-tools*.jar"/>
            <include name="openjson*.jar"/>
            <include name="jackcess*.jar"/>
            <include name="junrar*.jar"/>
            <include name="commons-vfs2*.jar"/>
            <include name="maven-scm*.jar"/>
            <include name="regexp*.jar"/>
            <include name="commons-csv*.jar"/>
            <include name="netcdf4*.jar"/>
            <include name="httpservices*.jar"/>
            <include name="grib*.jar"/>
            <include name="cdm*.jar"/>
            <include name="udunits*.jar"/>
            <include name="jcommander*.jar"/>
            <include name="jcip-annotations*.jar"/>
            <include name="ehcache-core*.jar"/>
            <include name="bzip2*.jar"/>
            <include name="jdom2*.jar"/>
            <include name="jbig2-imageio*.jar"/>
            <include name="jai-imageio-core*.jar"/>
            <include name="quartz*.jar"/>
            <include name="c3p0*.jar"/>
            <include name="sentiment-analysis-parser*.jar"/>
            <include name="uimafit-core*.jar"/>
            <include name="uimaj-core*.jar"/>
            <include name="tagsoup*.jar"/>
            <include name="vorbis-java*.jar"/>
            <include name="apache-mime4j-core*.jar"/>
            <include name="apache-mime4j-dom*.jar"/>
            <include name="commons-compress*.jar"/>
            <include name="pdfbox*.jar"/>
            <include name="fontbox*.jar"/>
            <include name="jempbox*.jar"/>
            <include name="xmpbox*.jar"/>
            <include name="preflight*.jar"/>
            	<!--
            <include name="bcmail-jdk15on*.jar"/>
            <include name="bcutil-jdk15on*.jar"/>
            <include name="bcprov-jdk15on*.jar"/>
            <include name="bcpkix-jdk15on*.jar"/>
            -->
            <include name="bcmail-jdk18on*.jar"/>
            <include name="bcutil-jdk18on*.jar"/>
            <include name="bcprov-jdk18on*.jar"/>
            <include name="bcpkix-jdk18on*.jar"/>
            
            <include name="SparseBitSet*.jar"/>
            <include name="HikariCP-java7*.jar"/>
            <include name="geronimo-stax-api_1.0_spec*.jar"/>
            <include name="asm*.jar"/>
            <include name="isoparser*.jar"/>
            <include name="aspectjrt*.jar"/>
            <include name="xmpcore*.jar"/>
            <include name="mchange-commons-java*.jar"/>
            <include name="dd-plist*.jar"/>
            <include name="xml-apis*.jar"/>
            <include name="boilerpipe*.jar"/>
            <include name="rome*.jar"/>
            <include name="jdom*.jar"/>
            <include name="xercesImpl*.jar"/>
            <include name="vorbis-java-core*.jar"/>
            <include name="juniversalchardet*.jar"/>
            <include name="jhighlight*.jar"/>
            <include name="jmatio*.jar"/>
            <include name="metadata-extractor*.jar"/>
            <include name="java-libpst*.jar"/>
            <include name="xz*.jar"/>
            <include name="parso*.jar"/>
            <include name="dec*.jar"/>
            <include name="cxf-*.jar"/>
            <include name="policy*.jar"/>
            <include name="gmbal*.jar"/>
            <include name="pfl-*.jar"/>
            <include name="management-api*.jar"/>
            <include name="stax-ex*.jar"/>
            <include name="ha-api*.jar"/>
            <include name="neethi*.jar"/>
            <include name="xml-resolver*.jar"/>
            <include name="xmlschema-core*.jar"/>
            <include name="jakarta.*.jar"/>
            <include name="jaxb*.jar"/>
            <include name="jakarta.xml.bind-api*.jar"/>
            <include name="xsom*.jar"/>
            <include name="codemodel*.jar"/>
            <include name="rngom*.jar"/>
            <include name="dtd-parser*.jar"/>
            <include name="ant*.jar"/>
            <include name="relaxng-datatype*.jar"/>
            <include name="txw2*.jar"/>
            <include name="istack-commons*.jar"/>
            <include name="FastInfoset*.jar"/>
            <include name="velocity-engine-core*.jar"/>
            <include name="jakarta.xml.ws-api*.jar"/>
            <include name="jakarta.annotation-api*.jar"/>
            <include name="jakarta.jws-api*.jar"/>
        </fileset>
        <fileset dir="../lib">
            <include name="castor*.jar"/>
            <include name="jakarta.mail-api*.jar"/>
            <include name="commons-discovery*.jar"/>
            <include name="axis*.jar"/>
            <include name="wss4j*.jar"/>
            <include name="saaj*.jar"/>
            <include name="wsdl4j*.jar"/>
            <include name="xmlsec*.jar"/>
            <include name="opensaml*.jar"/>
            <!--include name="activation*.jar"/-->
        </fileset>
    </path>

    <target name="file-resources">
        <mkdir dir="dist/file-resources"/>
        <copy todir="dist/file-resources">
            <fileset dir="example-file-resources">
                <include name="README.txt"/>
            </fileset>
        </copy>
    </target>
    
    <target name="doc">
        <mkdir dir="dist/doc"/>
        <javadoc destdir="dist/doc" maxmemory="256M" source="21" useexternalfile="true" use="true" locale="en_US">
            <link href="http://docs.oracle.com/javase/8/docs/api/"/>
            <link href="http://manifoldcf.apache.org/release/trunk/api/framework/"/>
            <classpath>
                <path refid="framework-classpath"/>
                <path refid="connector-common-classpath"/>
            </classpath>
            <fileset dir="core/src/main/java" includes="**/*.java"/>
            <fileset dir="agents/src/main/java" includes="**/*.java"/>
            <fileset dir="pull-agent/src/main/java" includes="**/*.java"/>
            <fileset dir="ui-core/src/main/java" includes="**/*.java"/>
            <fileset dir="connector-common/src/main/java" includes="**/*.java"/>
            <fileset dir="script-engine/src/main/java" includes="**/*.java"/>
            <fileset dir="jetty-runner/src/main/java" includes="**/*.java"/>
        </javadoc>
    </target>

    <target name="compile-less-compiler">
        <mkdir dir="build/less-compiler/classes"/>
        <javac srcdir="less-compiler/src/main/java" destdir="build/less-compiler/classes" deprecation="true" target="21" source="21" debug="true" encoding="utf-8" debuglevel="lines,vars,source">
            <classpath>
                <path refid="less-classpath"/>
            </classpath>
        </javac>
    </target>

    <target name="compile-core">
        <mkdir dir="build/core/classes"/><native2ascii encoding="UTF-8" src="ui-core/src/main/native2ascii" dest="build/ui-core/classes" includes="**/*.properties" />
        <javac srcdir="core/src/main/java" destdir="build/core/classes" deprecation="true" target="21" source="21" debug="true" encoding="utf-8" debuglevel="lines,vars,source">
            <classpath>
                <path refid="framework-classpath"/>
            </classpath>
        </javac>
    </target>

    <target name="compile-ui-core" depends="compile-core">
        <mkdir dir="build/ui-core/classes"/>
        <javac srcdir="ui-core/src/main/java" destdir="build/ui-core/classes" deprecation="true" target="21" source="21" debug="true" encoding="utf-8" debuglevel="lines,vars,source">
            <classpath>
                <path refid="framework-classpath"/>
                <pathelement location="build/core/classes"/>
            </classpath>
        </javac>
        <native2ascii encoding="UTF-8" src="ui-core/src/main/native2ascii" dest="build/ui-core/classes" includes="**/*.properties" />
    </target>

    <target name="compile-agents" depends="compile-core">
        <mkdir dir="build/agents/classes"/>
        <javac srcdir="agents/src/main/java" destdir="build/agents/classes" deprecation="true" target="21" source="21" debug="true" encoding="utf-8" debuglevel="lines,vars,source">
            <classpath>
                <path refid="framework-classpath"/>
                <pathelement location="build/core/classes"/>
           </classpath>
        </javac>
    </target>

    <target name="compile-connector-common" depends="compile-core,compile-agents,compile-ui-core">
        <mkdir dir="build/connector-common/classes"/>
        <copy todir="build/connector-common/classes">
            <fileset dir="connector-common/src/main/resources"/>
        </copy>
        <javac srcdir="connector-common/src/main/java" destdir="build/connector-common/classes" deprecation="true" target="21" source="21" debug="true" encoding="utf-8" debuglevel="lines,vars,source">
            <classpath>
                <path refid="framework-classpath"/>
                <path refid="connector-common-classpath"/>
                <pathelement location="build/core/classes"/>
                <pathelement location="build/agents/classes"/>
                <pathelement location="build/ui-core/classes"/>
           </classpath>
        </javac>
    </target>

    <target name="compile-pull-agent" depends="compile-core,compile-agents">
        <mkdir dir="build/pull-agent/classes"/>
        <javac srcdir="pull-agent/src/main/java" destdir="build/pull-agent/classes" deprecation="true" target="21" source="21" debug="true" encoding="utf-8" debuglevel="lines,vars,source">
            <classpath>
                <path refid="framework-classpath"/>
                <pathelement location="build/core/classes"/>
                <pathelement location="build/agents/classes"/>
            </classpath>
        </javac>
    </target>

    <target name="compile-jetty-runner" depends="compile-core,compile-agents">
        <mkdir dir="build/jetty-runner/classes"/>
        <javac srcdir="jetty-runner/src/main/java" destdir="build/jetty-runner/classes" deprecation="true" target="21" source="21" debug="true" encoding="utf-8" debuglevel="lines,vars,source">
            <classpath>
                <path refid="framework-classpath"/>
                <pathelement location="build/core/classes"/>
                <pathelement location="build/agents/classes"/>
                <pathelement location="build/pull-agent/classes"/>
            </classpath>
        </javac>
    </target>

    <target name="compile-script-engine" depends="compile-core">
        <mkdir dir="build/script-engine/classes"/>
        <javac srcdir="script-engine/src/main/java" destdir="build/script-engine/classes" deprecation="true" target="21" source="21" debug="true" encoding="utf-8" debuglevel="lines,vars,source">
            <classpath>
                <path refid="framework-classpath"/>
                <pathelement location="build/core/classes"/>
            </classpath>
        </javac>
    </target>

    <target name="compile-authority-servlet" depends="compile-core,compile-agents,compile-pull-agent">
        <mkdir dir="build/authority-servlet/classes"/>
        <javac srcdir="authority-servlet/src/main/java" destdir="build/authority-servlet/classes" deprecation="true" target="21" source="21" debug="true" encoding="utf-8" debuglevel="lines,vars,source">
            <classpath>
                <path refid="framework-classpath"/>
                <pathelement location="build/core/classes"/>
                <pathelement location="build/agents/classes"/>
                <pathelement location="build/pull-agent/classes"/>
            </classpath>
        </javac>
    </target>

    <target name="compile-authority-service" depends="compile-core,compile-agents,compile-pull-agent,compile-authority-servlet">
        <mkdir dir="build/authority-service/classes"/>
        <javac srcdir="authority-service/src/main/java" destdir="build/authority-service/classes" deprecation="true" target="21" source="21" debug="true" encoding="utf-8" debuglevel="lines,vars,source">
            <classpath>
                <path refid="framework-classpath"/>
                <pathelement location="build/core/classes"/>
                <pathelement location="build/agents/classes"/>
                <pathelement location="build/pull-agent/classes"/>
                <pathelement location="build/authority-servlet/classes"/>
            </classpath>
        </javac>
    </target>

    <target name="compile-api-servlet" depends="compile-core,compile-ui-core,compile-agents,compile-pull-agent">
        <mkdir dir="build/api-servlet/classes"/>
        <javac srcdir="api-servlet/src/main/java" destdir="build/api-servlet/classes" deprecation="true" target="21" source="21" debug="true" encoding="utf-8" debuglevel="lines,vars,source">
            <classpath>
                <path refid="framework-classpath"/>
                <pathelement location="build/core/classes"/>
                <pathelement location="build/ui-core/classes"/>
                <pathelement location="build/agents/classes"/>
                <pathelement location="build/pull-agent/classes"/>
            </classpath>
        </javac>
    </target>

    <target name="compile-api-service" depends="compile-core,compile-ui-core,compile-agents,compile-pull-agent,compile-api-servlet">
        <mkdir dir="build/api-service/classes"/>
        <javac srcdir="api-service/src/main/java" destdir="build/api-service/classes" deprecation="true" target="21" source="21" debug="true" encoding="utf-8" debuglevel="lines,vars,source">
            <classpath>
                <path refid="framework-classpath"/>
                <pathelement location="build/core/classes"/>
                <pathelement location="build/ui-core/classes"/>
                <pathelement location="build/agents/classes"/>
                <pathelement location="build/pull-agent/classes"/>
                <pathelement location="build/api-servlet/classes"/>
            </classpath>
        </javac>
    </target>

    <target name="compile-combined-service" depends="compile-core,compile-ui-core,compile-agents,compile-pull-agent,compile-api-servlet,compile-authority-servlet">
        <mkdir dir="build/combined-service/classes"/>
        <javac srcdir="combined-service/src/main/java" destdir="build/combined-service/classes" deprecation="true" target="21" source="21" encoding="utf-8" debug="true" debuglevel="lines,vars,source">
            <classpath>
                <path refid="framework-classpath"/>
                <pathelement location="build/core/classes"/>
                <pathelement location="build/ui-core/classes"/>
                <pathelement location="build/agents/classes"/>
                <pathelement location="build/pull-agent/classes"/>
                <pathelement location="build/api-servlet/classes"/>
                <pathelement location="build/authority-servlet/classes"/>
            </classpath>
        </javac>
    </target>

    <target name="less-compiler-invocation" depends="compile-less-compiler">
        <mkdir dir="build/crawler-ui/css"/>
        <java classname="org.apache.manifoldcf.less.MCFLessCompiler" fork="true" failonerror="true" maxmemory="128m">
            <arg value="crawler-ui/src/main/less/style.less"/>
            <arg value="build/crawler-ui/css/style.css"/>
            <!-- Compress less output -->
            <arg value="true"/>
            <classpath>
                <path refid="less-classpath"/>
                <pathelement location="build/less-compiler/classes"/>
            </classpath>
        </java>
    </target>

    <target name="compile-crawler-ui" depends="less-compiler-invocation,compile-core,compile-ui-core,compile-agents,compile-pull-agent">
        <mkdir dir="build/crawler-ui/classes"/>
        <javac srcdir="crawler-ui/src/main/java" destdir="build/crawler-ui/classes" deprecation="true" target="21" source="21" debug="true" encoding="utf-8" debuglevel="lines,vars,source">
            <classpath>
                <path refid="framework-classpath"/>
                <pathelement location="build/core/classes"/>
                <pathelement location="build/ui-core/classes"/>
                <pathelement location="build/agents/classes"/>
                <pathelement location="build/pull-agent/classes"/>
            </classpath>
        </javac>

        <!-- Define the jsp compilation task using tomcat libraries -->
        <taskdef classname="org.apache.jasper.JspC" name="jasper2" > 
            <classpath id="jspc.classpath"> 
                <pathelement location="${java.home}/../lib/tools.jar"/>
                <path refid="framework-classpath"/>
                <pathelement location="build/core/classes"/>
                <pathelement location="build/ui-core/classes"/>
                <pathelement location="build/agents/classes"/>
                <pathelement location="build/pull-agent/classes"/>
                <fileset dir="../lib">
                    <include name="tomcat-jasper-el*.jar"/>
                    <include name="jakarta.el-api*.jar"/>
                    <include name="jakarta.servlet.jsp.jstl-*.jar"/>
                </fileset>
            </classpath> 
        </taskdef > 
        <!-- Compile jsp's to java -->
        <mkdir dir="build/crawler-ui/java"/>
        <jasper2 validateXml="false" uriroot="crawler-ui/src/main/webapp" webFragmentXml="build/crawler-ui/web-generated.xml" outputDir="build/crawler-ui/java" /> 
        <!-- Compile java classes -->
        <mkdir dir="build/crawler-ui/classes"/>
        <javac srcdir="build/crawler-ui/java" destdir="build/crawler-ui/classes" deprecation="true" target="21" source="21" debug="true" encoding="utf-8" debuglevel="lines,vars,source">
            <classpath id="classpath">
                <pathelement location="${java.home}/../lib/tools.jar"/>
                <path refid="framework-classpath"/>
                <pathelement location="build/core/classes"/>
                <pathelement location="build/ui-core/classes"/>
                <pathelement location="build/agents/classes"/>
                <pathelement location="build/pull-agent/classes"/>
                <fileset dir="../lib">
                    <include name="jstl*.jar"/>
                </fileset>
            </classpath>

        </javac>
    </target>

    <target name="jar-core" depends="compile-core">
        <mkdir dir="build/jar"/>
        <jar destfile="build/jar/mcf-core.jar">
          <fileset dir="build/core/classes"/>
        </jar>
    </target>

    <target name="jar-ui-core" depends="compile-ui-core">
        <mkdir dir="build/jar"/>
        <jar destfile="build/jar/mcf-ui-core.jar">
          <fileset dir="build/ui-core/classes"/>
        </jar>
    </target>

    <target name="jar-agents" depends="compile-agents">
        <mkdir dir="build/jar"/>
        <jar destfile="build/jar/mcf-agents.jar" basedir="build/agents/classes"/>
    </target>

    <target name="jar-connector-common" depends="compile-connector-common">
        <mkdir dir="build/jar"/>
        <jar destfile="build/jar/mcf-connector-common.jar" basedir="build/connector-common/classes"/>
    </target>
    
    <target name="jar-pull-agent" depends="compile-pull-agent">
        <mkdir dir="build/jar"/>
        <jar destfile="build/jar/mcf-pull-agent.jar" basedir="build/pull-agent/classes"/>
    </target>

    <target name="jar-jetty-runner" depends="compile-jetty-runner">
        <mkdir dir="build/jar"/>
        <jar destfile="build/jar/mcf-jetty-runner.jar" basedir="build/jetty-runner/classes"/>
    </target>

    <target name="jar-script-engine" depends="compile-script-engine">
        <mkdir dir="build/jar"/>
        <jar destfile="build/jar/mcf-script-engine.jar" basedir="build/script-engine/classes"/>
    </target>

    <target name="jar-authority-servlet" depends="compile-authority-servlet">
        <mkdir dir="build/jar"/>
        <jar destfile="build/jar/mcf-authority-servlet.jar" basedir="build/authority-servlet/classes"/>
    </target>

    <target name="jar-api-servlet" depends="compile-api-servlet">
        <mkdir dir="build/jar"/>
        <jar destfile="build/jar/mcf-api-servlet.jar" basedir="build/api-servlet/classes"/>
    </target>

    <target name="webapp-authority-service" depends="jar-core,jar-agents,jar-pull-agent,jar-authority-servlet,compile-authority-service">
        <mkdir dir="build/webapp/authority-service/WEB-INF/lib"/>
        <copy todir="build/webapp/authority-service/WEB-INF/lib">
            <fileset dir="../lib">
                <include name="zookeeper*.jar"/>
                <include name="netty-handler*.jar"/>
                <include name="json-simple*.jar"/>
                <include name="commons-codec*.jar"/>
                <include name="commons-collections*.jar"/>
                <include name="commons-collections4*.jar"/>
                <include name="commons-el*.jar"/>
                <include name="commons-fileupload2-*.jar"/>
                <include name="httpcore*.jar"/>
                <include name="httpclient*.jar"/>
                <include name="commons-io*.jar"/>
                <include name="commons-lang*.jar"/>
                <include name="commons-logging*.jar"/>
                <include name="log4j-api-*.jar"/>
                <include name="log4j-core-*.jar"/>
                <include name="log4j-1.2-api-*.jar"/>
                <include name="serializer*.jar"/>
                <include name="xalan*.jar"/>
                <include name="xercesImpl*.jar"/>
                <include name="xml-apis*.jar"/>
                <include name="slf4j*.jar"/>
                <include name="jakarta.mail-api*.jar"/>
                <include name="commons-exec*.jar"/>
                <include name="gson*.jar"/>
                <include name="guava*.jar"/>
                <include name="jna*.jar"/>
            </fileset>
            <fileset dir="../lib">
                <include name="jakarta.activation-api*.jar"/>
                <include name="jakarta.xml.bind-api*.jar"/>
                <include name="jakarta.xml.ws-api*.jar"/>
                <include name="jakarta.xml.soap-api*.jar"/>
                <include name="jakarta.annotation-api*.jar"/>
                <include name="jakarta.ws.rs-api*.jar"/>
                <include name="jakarta.jws-api*.jar"/>
                <include name="angus-activation*.jar"/>
            </fileset>
            <fileset dir="../lib">
                <include name="postgresql*.jar"/>
                <include name="hsqldb*.jar"/>
            </fileset>
        </copy>
        <copy todir="build/webapp/authority-service/WEB-INF/lib">
            <fileset dir="build/jar">
                <include name="mcf-core.jar"/>
                <include name="mcf-agents.jar"/>
                <include name="mcf-pull-agent.jar"/>
                <include name="mcf-authority-servlet.jar"/>
            </fileset>
        </copy>
        <jar destfile="build/webapp/authority-service/WEB-INF/lib/mcf-authority-service.jar" basedir="build/authority-service/classes"/>
    </target>

    <target name="webapp-authority-service-proprietary" depends="jar-core,jar-agents,jar-pull-agent,jar-authority-servlet,compile-authority-service">
        <mkdir dir="build/webapp/authority-service-proprietary/WEB-INF/lib"/>
        <copy todir="build/webapp/authority-service-proprietary/WEB-INF/lib">
            <fileset dir="../lib">
                <include name="zookeeper*.jar"/>
                <include name="netty-handler*.jar"/>
                <include name="json-simple*.jar"/>
                <include name="commons-codec*.jar"/>
                <include name="commons-collections*.jar"/>
                <include name="commons-collections4*.jar"/>
                <include name="commons-el*.jar"/>
                <include name="commons-fileupload2-*.jar"/>
                <include name="httpcore*.jar"/>
                <include name="httpclient*.jar"/>
                <include name="commons-io*.jar"/>
                <include name="commons-lang*.jar"/>
                <include name="commons-logging*.jar"/>
                <include name="log4j-api-*.jar"/>
                <include name="log4j-core-*.jar"/>
                <include name="log4j-1.2-api-*.jar"/>
                <include name="serializer*.jar"/>
                <include name="xalan*.jar"/>
                <include name="xercesImpl*.jar"/>
                <include name="xml-apis*.jar"/>
                <include name="slf4j*.jar"/>
                <include name="jakarta.mail-api*.jar"/>
                <include name="commons-exec*.jar"/>
                <include name="gson*.jar"/>
                <include name="guava*.jar"/>
                <include name="jna*.jar"/>
            </fileset>
            <fileset dir="../lib">
                <include name="jakarta.activation-api*.jar"/>
                <include name="jakarta.xml.bind-api*.jar"/>
                <include name="jakarta.xml.ws-api*.jar"/>
                <include name="jakarta.xml.soap-api*.jar"/>
                <include name="jakarta.annotation-api*.jar"/>
                <include name="jakarta.ws.rs-api*.jar"/>
                <include name="jakarta.jws-api*.jar"/>
                <include name="angus-activation*.jar"/>
            </fileset>
            <fileset dir="../lib">
                <include name="postgresql*.jar"/>
                <include name="hsqldb*.jar"/>
            </fileset>
            <fileset dir="../lib-proprietary">
                <include name="mysql*.jar"/>
                <include name="ojdbc*.jar"/>
                <include name="jtds*.jar"/>
                <include name="mariadb-java-client*.jar"/>
            </fileset>
        </copy>
        <copy todir="build/webapp/authority-service-proprietary/WEB-INF/lib">
            <fileset dir="build/jar">
                <include name="mcf-core.jar"/>
                <include name="mcf-agents.jar"/>
                <include name="mcf-pull-agent.jar"/>
                <include name="mcf-authority-servlet.jar"/>
            </fileset>
        </copy>
        <jar destfile="build/webapp/authority-service-proprietary/WEB-INF/lib/mcf-authority-service.jar" basedir="build/authority-service/classes"/>
    </target>

    <target name="webapp-api-service" depends="jar-core,jar-ui-core,jar-agents,jar-pull-agent,jar-api-servlet,compile-api-service">
        <mkdir dir="build/webapp/api-service/WEB-INF/lib"/>
        <copy todir="build/webapp/api-service/WEB-INF/lib">
            <fileset dir="../lib">
                <include name="zookeeper*.jar"/>
                <include name="netty-handler*.jar"/>
                <include name="json-simple*.jar"/>
                <include name="commons-codec*.jar"/>
                <include name="commons-collections*.jar"/>
                <include name="commons-collections4*.jar"/>
                <include name="commons-el*.jar"/>
                <include name="commons-fileupload2-*.jar"/>
                <include name="httpcore*.jar"/>
                <include name="httpclient*.jar"/>
                <include name="commons-io*.jar"/>
                <include name="commons-lang*.jar"/>
                <include name="commons-logging*.jar"/>
                <include name="log4j-api-*.jar"/>
                <include name="log4j-core-*.jar"/>
                <include name="log4j-1.2-api-*.jar"/>
                <include name="serializer*.jar"/>
                <include name="xalan*.jar"/>
                <include name="xercesImpl*.jar"/>
                <include name="xml-apis*.jar"/>
                <include name="slf4j*.jar"/>
                <include name="jakarta.mail-api*.jar"/>
                <include name="commons-exec*.jar"/>
                <include name="gson*.jar"/>
                <include name="guava*.jar"/>
                <include name="jna*.jar"/>
            </fileset>
            <fileset dir="../lib">
                <include name="jakarta.activation-api*.jar"/>
                <include name="jakarta.xml.bind-api*.jar"/>
                <include name="jakarta.xml.ws-api*.jar"/>
                <include name="jakarta.xml.soap-api*.jar"/>
                <include name="jakarta.annotation-api*.jar"/>
                <include name="jakarta.ws.rs-api*.jar"/>
                <include name="jakarta.jws-api*.jar"/>
                <include name="angus-activation*.jar"/>
            </fileset>
            <fileset dir="../lib">
                <include name="postgresql*.jar"/>
                <include name="hsqldb*.jar"/>
            </fileset>
        </copy>
        <copy todir="build/webapp/api-service/WEB-INF/lib">
            <fileset dir="build/jar">
                <include name="mcf-core.jar"/>
                <include name="mcf-ui-core.jar"/>
                <include name="mcf-agents.jar"/>
                <include name="mcf-pull-agent.jar"/>
                <include name="mcf-api-servlet.jar"/>
            </fileset>
        </copy>
        <jar destfile="build/webapp/api-service/WEB-INF/lib/mcf-api-service.jar" basedir="build/api-service/classes"/>
    </target>

    <target name="webapp-api-service-proprietary" depends="jar-core,jar-ui-core,jar-agents,jar-pull-agent,jar-api-servlet,compile-api-service">
        <mkdir dir="build/webapp/api-service-proprietary/WEB-INF/lib"/>
        <copy todir="build/webapp/api-service-proprietary/WEB-INF/lib">
            <fileset dir="../lib">
                <include name="zookeeper*.jar"/>
                <include name="netty-handler*.jar"/>
                <include name="json-simple*.jar"/>
                <include name="commons-codec*.jar"/>
                <include name="commons-collections*.jar"/>
                <include name="commons-collections4*.jar"/>
                <include name="commons-el*.jar"/>
                <include name="commons-fileupload2-*.jar"/>
                <include name="httpcore*.jar"/>
                <include name="httpclient*.jar"/>
                <include name="commons-io*.jar"/>
                <include name="commons-lang*.jar"/>
                <include name="commons-logging*.jar"/>
                <include name="log4j-api-*.jar"/>
                <include name="log4j-core-*.jar"/>
                <include name="log4j-1.2-api-*.jar"/>
                <include name="serializer*.jar"/>
                <include name="xalan*.jar"/>
                <include name="xercesImpl*.jar"/>
                <include name="xml-apis*.jar"/>
                <include name="slf4j*.jar"/>
                <include name="jakarta.mail-api*.jar"/>
                <include name="commons-exec*.jar"/>
                <include name="gson*.jar"/>
                <include name="guava*.jar"/>
                <include name="jna*.jar"/>
            </fileset>
            <fileset dir="../lib">
                <include name="jakarta.activation-api*.jar"/>
                <include name="jakarta.xml.bind-api*.jar"/>
                <include name="jakarta.xml.ws-api*.jar"/>
                <include name="jakarta.xml.soap-api*.jar"/>
                <include name="jakarta.annotation-api*.jar"/>
                <include name="jakarta.ws.rs-api*.jar"/>
                <include name="jakarta.jws-api*.jar"/>
                <include name="angus-activation*.jar"/>
            </fileset>
            <fileset dir="../lib">
                <include name="postgresql*.jar"/>
                <include name="hsqldb*.jar"/>
            </fileset>
            <fileset dir="../lib-proprietary">
                <include name="mysql*.jar"/>
                <include name="ojdbc*.jar"/>
                <include name="jtds*.jar"/>
                <include name="mariadb-java-client*.jar"/>
            </fileset>
        </copy>
        <copy todir="build/webapp/api-service-proprietary/WEB-INF/lib">
            <fileset dir="build/jar">
                <include name="mcf-core.jar"/>
                <include name="mcf-ui-core.jar"/>
                <include name="mcf-agents.jar"/>
                <include name="mcf-pull-agent.jar"/>
                <include name="mcf-api-servlet.jar"/>
            </fileset>
        </copy>
        <jar destfile="build/webapp/api-service-proprietary/WEB-INF/lib/mcf-api-service.jar" basedir="build/api-service/classes"/>
    </target>

    <target name="webapp-crawler-ui" depends="compile-crawler-ui,jar-core,jar-ui-core,jar-agents,jar-pull-agent">
        <mkdir dir="build/webapp/crawler-ui/WEB-INF/lib"/>
        <copy todir="build/webapp/crawler-ui/WEB-INF/lib">
            <fileset dir="../lib">
                <include name="jstl*.jar"/>
                <include name="zookeeper*.jar"/>
                <include name="netty-handler*.jar"/>
                <include name="json-simple*.jar"/>
                <include name="commons-codec*.jar"/>
                <include name="commons-collections*.jar"/>
                <include name="commons-collections4*.jar"/>
                <include name="commons-el*.jar"/>
                <include name="commons-fileupload2-*.jar"/>
                <include name="http2*.jar"/>
                <include name="httpcore*.jar"/>
                <include name="httpclient*.jar"/>
                <include name="jetty*.jar"/>
                <include name="commons-io*.jar"/>
                <include name="commons-lang*.jar"/>
                <include name="commons-logging*.jar"/>
                <include name="log4j-api-*.jar"/>
                <include name="log4j-core-*.jar"/>
                <include name="log4j-1.2-api-*.jar"/>
                <include name="serializer*.jar"/>
                <include name="xalan*.jar"/>
                <include name="xercesImpl*.jar"/>
                <include name="xml-apis*.jar"/>
                <include name="velocity*.jar"/>
                <include name="slf4j*.jar"/>
                <include name="jakarta.mail-api*.jar"/>
                <include name="commons-exec*.jar"/>
                <include name="gson*.jar"/>
                <include name="guava*.jar"/>
                <include name="jna*.jar"/>
            </fileset>
            <fileset dir="../lib">
                <include name="jakarta.activation-api*.jar"/>
                <include name="jakarta.xml.bind-api*.jar"/>
                <include name="jakarta.xml.ws-api*.jar"/>
                <include name="jakarta.xml.soap-api*.jar"/>
                <include name="jakarta.annotation-api*.jar"/>
                <include name="jakarta.ws.rs-api*.jar"/>
                <include name="jakarta.jws-api*.jar"/>
                <include name="angus-activation*.jar"/>
            </fileset>
            <fileset dir="../lib">
                <include name="postgresql*.jar"/>
                <include name="hsqldb*.jar"/>
            </fileset>
            <fileset dir="build/jar">
                <include name="mcf-core.jar"/>
                <include name="mcf-agents.jar"/>
                <include name="mcf-pull-agent.jar"/>
                <include name="mcf-ui-core.jar"/>
            </fileset>
        </copy>
        <mkdir dir="build/webapp/crawler-ui/WEB-INF/jsp"/>
        <copy todir="build/webapp/crawler-ui/WEB-INF/jsp">
            <fileset dir="crawler-ui/src/main/webapp/WEB-INF/jsp">
                <include name="*.tld"/>
            </fileset>
        </copy>
        <copy todir="build/webapp/crawler-ui">
            <fileset dir="crawler-ui/src/main/webapp" includes="**/*.jsp,**/*.css,**/*.map,**/*.png,**/*.html,**/*.js,**/*.eot,**/*.svg,**/*.ttf,**/*.woff,**/*.woff2"/>
        </copy>
        <mkdir dir="build/webapp/crawler-ui/css"/>
        <copy todir="build/webapp/crawler-ui/css">
            <fileset dir="build/crawler-ui/css" includes="**/*.css,**/*.map"/>
        </copy>
        <jar destfile="build/webapp/crawler-ui/WEB-INF/lib/mcf-crawler-ui.jar" basedir="build/crawler-ui/classes"/>
    </target>
  
      <target name="webapp-crawler-ui-proprietary" depends="compile-crawler-ui,jar-core,jar-ui-core,jar-agents,jar-pull-agent">
        <mkdir dir="build/webapp/crawler-ui-proprietary/WEB-INF/lib"/>
        <copy todir="build/webapp/crawler-ui-proprietary/WEB-INF/lib">
            <fileset dir="../lib">
                <include name="jstl*.jar"/>
                <include name="zookeeper*.jar"/>
                <include name="netty-handler*.jar"/>
                <include name="json-simple*.jar"/>
                <include name="commons-codec*.jar"/>
                <include name="commons-collections*.jar"/>
                <include name="commons-collections4*.jar"/>
                <include name="commons-el*.jar"/>
                <include name="commons-fileupload2-*.jar"/>
                <include name="http2*.jar"/>
                <include name="httpcore*.jar"/>
                <include name="httpclient*.jar"/>
                <include name="jetty*.jar"/>
                <include name="commons-io*.jar"/>
                <include name="commons-lang*.jar"/>
                <include name="commons-logging*.jar"/>
                <include name="log4j-api-*.jar"/>
                <include name="log4j-core-*.jar"/>
                <include name="log4j-1.2-api-*.jar"/>
                <include name="serializer*.jar"/>
                <include name="xalan*.jar"/>
                <include name="xercesImpl*.jar"/>
                <include name="xml-apis*.jar"/>
                <include name="velocity*.jar"/>
                <include name="slf4j*.jar"/>
                <include name="jakarta.mail-api*.jar"/>
                <include name="commons-exec*.jar"/>
                <include name="gson*.jar"/>
                <include name="guava*.jar"/>
                <include name="jna*.jar"/>
            </fileset>
            <fileset dir="../lib">
                <include name="jakarta.activation-api*.jar"/>
                <include name="jakarta.xml.bind-api*.jar"/>
                <include name="jakarta.xml.ws-api*.jar"/>
                <include name="jakarta.xml.soap-api*.jar"/>
                <include name="jakarta.annotation-api*.jar"/>
                <include name="jakarta.ws.rs-api*.jar"/>
                <include name="jakarta.jws-api*.jar"/>
                <include name="angus-activation*.jar"/>
            </fileset>
            <fileset dir="../lib">
                <include name="postgresql*.jar"/>
                <include name="hsqldb*.jar"/>
            </fileset>
            <fileset dir="../lib-proprietary">
                <include name="mysql*.jar"/>
                <include name="ojdbc*.jar"/>
                <include name="jtds*.jar"/>
                <include name="mariadb-java-client*.jar"/>
            </fileset>
        </copy>
        <copy todir="build/webapp/crawler-ui-proprietary/WEB-INF/lib">
            <fileset dir="build/jar">
                <include name="mcf-core.jar"/>
                <include name="mcf-agents.jar"/>
                <include name="mcf-pull-agent.jar"/>
                <include name="mcf-ui-core.jar"/>
            </fileset>
        </copy>
        <mkdir dir="build/webapp/crawler-ui-proprietary/WEB-INF/jsp"/>
        <copy todir="build/webapp/crawler-ui-proprietary/WEB-INF/jsp">
            <fileset dir="crawler-ui/src/main/webapp/WEB-INF/jsp">
                <include name="*.tld"/>
            </fileset>
        </copy>
        <copy todir="build/webapp/crawler-ui-proprietary">
            <fileset dir="crawler-ui/src/main/webapp" includes="**/*.jsp,**/*.css,**/*.map,**/*.png,**/*.html,**/*.js,**/*.eot,**/*.svg,**/*.ttf,**/*.woff,**/*.woff2"/>
        </copy>
        <mkdir dir="build/webapp/crawler-ui-proprietary/css"/>
        <copy todir="build/webapp/crawler-ui-proprietary/css">
            <fileset dir="build/crawler-ui/css" includes="**/*.css,**/*.map"/>
        </copy>
        <jar destfile="build/webapp/crawler-ui-proprietary/WEB-INF/lib/mcf-crawler-ui.jar" basedir="build/crawler-ui/classes"/>
    </target>

    <target name="webapp-combined-service" depends="compile-combined-service,jar-core,jar-ui-core,jar-agents,jar-pull-agent,jar-api-servlet,jar-authority-servlet">
        <mkdir dir="build/webapp/combined-service/WEB-INF/lib"/>
        <copy todir="build/webapp/combined-service/WEB-INF/lib">
            <fileset dir="../lib">
                <include name="jstl*.jar"/>
                <include name="zookeeper*.jar"/>
                <include name="netty-handler*.jar"/>
                <include name="json-simple*.jar"/>
                <include name="commons-codec*.jar"/>
                <include name="commons-collections*.jar"/>
                <include name="commons-collections4*.jar"/>
                <include name="commons-el*.jar"/>
                <include name="commons-fileupload2-*.jar"/>
                <include name="httpcore*.jar"/>
                <include name="httpclient*.jar"/>
                <include name="commons-io*.jar"/>
                <include name="commons-lang*.jar"/>
                <include name="commons-logging*.jar"/>
                <include name="log4j-api-*.jar"/>
                <include name="log4j-core-*.jar"/>
                <include name="log4j-1.2-api-*.jar"/>
                <include name="serializer*.jar"/>
                <include name="xalan*.jar"/>
                <include name="xercesImpl*.jar"/>
                <include name="xml-apis*.jar"/>
                <include name="velocity*.jar"/>
                <include name="slf4j*.jar"/>
                <include name="jakarta.mail-api*.jar"/>
                <include name="commons-exec*.jar"/>
                <include name="gson*.jar"/>
                <include name="guava*.jar"/>
                <include name="jna*.jar"/>
            </fileset>
            <fileset dir="../lib">
                <include name="jakarta.activation-api*.jar"/>
                <include name="jakarta.xml.bind-api*.jar"/>
                <include name="jakarta.xml.ws-api*.jar"/>
                <include name="jakarta.xml.soap-api*.jar"/>
                <include name="jakarta.annotation-api*.jar"/>
                <include name="jakarta.ws.rs-api*.jar"/>
                <include name="jakarta.jws-api*.jar"/>
                <include name="angus-activation*.jar"/>
            </fileset>
            <fileset dir="../lib">
                <include name="postgresql*.jar"/>
                <include name="hsqldb*.jar"/>
            </fileset>
            <fileset dir="build/jar">
                <include name="mcf-core.jar"/>
                <include name="mcf-agents.jar"/>
                <include name="mcf-pull-agent.jar"/>
                <include name="mcf-ui-core.jar"/>
                <include name="mcf-api-servlet.jar"/>
                <include name="mcf-authority-servlet.jar"/>
            </fileset>
        </copy>
        <mkdir dir="build/webapp/combined-service/WEB-INF/jsp"/>
        <copy todir="build/webapp/combined-service/WEB-INF/jsp">
            <fileset dir="crawler-ui/src/main/webapp/WEB-INF/jsp">
                <include name="*.tld"/>
            </fileset>
        </copy>
        <copy todir="build/webapp/combined-service">
            <fileset dir="crawler-ui/src/main/webapp" includes="**/*.jsp,**/*.css,**/*.map,**/*.png,**/*.html,**/*.js,**/*.eot,**/*.svg,**/*.ttf,**/*.woff,**/*.woff2"/>
        </copy>
        <mkdir dir="build/webapp/combined-service/css"/>
        <copy todir="build/webapp/combined-service/css">
            <fileset dir="build/crawler-ui/css" includes="**/*.css,**/*.map"/>
        </copy>
        <jar destfile="build/webapp/combined-service/WEB-INF/lib/mcf-combined-service.jar" basedir="build/combined-service/classes"/>
    </target>
  
      <target name="webapp-combined-service-proprietary" depends="compile-combined-service,jar-core,jar-ui-core,jar-agents,jar-pull-agent,jar-api-servlet,jar-authority-servlet">
        <mkdir dir="build/webapp/combined-service-proprietary/WEB-INF/lib"/>
        <copy todir="build/webapp/combined-service-proprietary/WEB-INF/lib">
            <fileset dir="../lib">
                <include name="jstl*.jar"/>
                <include name="zookeeper*.jar"/>
                <include name="netty-handler*.jar"/>
                <include name="json-simple*.jar"/>
                <include name="commons-codec*.jar"/>
                <include name="commons-collections*.jar"/>
                <include name="commons-collections4*.jar"/>
                <include name="commons-el*.jar"/>
                <include name="commons-fileupload2-*.jar"/>
                <include name="httpcore*.jar"/>
                <include name="httpclient*.jar"/>
                <include name="commons-io*.jar"/>
                <include name="commons-lang*.jar"/>
                <include name="commons-logging*.jar"/>
                <include name="log4j-api-*.jar"/>
                <include name="log4j-core-*.jar"/>
                <include name="log4j-1.2-api-*.jar"/>
                <include name="serializer*.jar"/>
                <include name="xalan*.jar"/>
                <include name="xercesImpl*.jar"/>
                <include name="xml-apis*.jar"/>
                <include name="velocity*.jar"/>
                <include name="slf4j*.jar"/>
                <include name="jakarta.mail-api*.jar"/>
                <include name="commons-exec*.jar"/>
                <include name="gson*.jar"/>
                <include name="guava*.jar"/>
                <include name="jna*.jar"/>
            </fileset>
            <fileset dir="../lib">
                <include name="jakarta.activation-api*.jar"/>
                <include name="jakarta.xml.bind-api*.jar"/>
                <include name="jakarta.xml.ws-api*.jar"/>
                <include name="jakarta.xml.soap-api*.jar"/>
                <include name="jakarta.annotation-api*.jar"/>
                <include name="jakarta.ws.rs-api*.jar"/>
                <include name="jakarta.jws-api*.jar"/>
                <include name="angus-activation*.jar"/>
            </fileset>
            <fileset dir="../lib">
                <include name="postgresql*.jar"/>
                <include name="hsqldb*.jar"/>
            </fileset>
            <fileset dir="../lib-proprietary">
                <include name="mysql*.jar"/>
                <include name="ojdbc*.jar"/>
                <include name="jtds*.jar"/>
                <include name="mariadb-java-client*.jar"/>
            </fileset>
        </copy>
        <copy todir="build/webapp/combined-service-proprietary/WEB-INF/lib">
            <fileset dir="build/jar">
                <include name="mcf-core.jar"/>
                <include name="mcf-agents.jar"/>
                <include name="mcf-pull-agent.jar"/>
                <include name="mcf-ui-core.jar"/>
                <include name="mcf-api-servlet.jar"/>
                <include name="mcf-authority-servlet.jar"/>
            </fileset>
        </copy>
        <mkdir dir="build/webapp/combined-service-proprietary/WEB-INF/jsp"/>
        <copy todir="build/webapp/combined-service-proprietary/WEB-INF/jsp">
            <fileset dir="crawler-ui/src/main/webapp/WEB-INF/jsp">
                <include name="*.tld"/>
            </fileset>
        </copy>
        <copy todir="build/webapp/combined-service-proprietary">
            <fileset dir="crawler-ui/src/main/webapp" includes="**/*.jsp,**/*.css,**/*.map,**/*.png,**/*.html,**/*.js,**/*.eot,**/*.svg,**/*.ttf,**/*.woff,**/*.woff2"/>
        </copy>
        <mkdir dir="build/webapp/combined-service/css"/>
        <copy todir="build/webapp/combined-service/css">
            <fileset dir="build/crawler-ui/css" includes="**/*.css,**/*.map"/>
        </copy>
        <jar destfile="build/webapp/combined-service-proprietary/WEB-INF/lib/mcf-combined-service.jar" basedir="build/combined-service/classes"/>
    </target>

    <target name="war-authority-service" depends="webapp-authority-service">
        <mkdir dir="build/war"/>
        <war destfile="build/war/mcf-authority-service.war" webxml="authority-service/src/main/webapp/WEB-INF/web.xml" basedir="build/webapp/authority-service"/>
    </target>

    <target name="war-authority-service-proprietary" depends="webapp-authority-service-proprietary">
        <mkdir dir="build/war-proprietary"/>
        <war destfile="build/war-proprietary/mcf-authority-service.war" webxml="authority-service/src/main/webapp/WEB-INF/web.xml" basedir="build/webapp/authority-service-proprietary"/>
    </target>

    <target name="war-api-service" depends="webapp-api-service">
        <mkdir dir="build/war"/>
        <war destfile="build/war/mcf-api-service.war" webxml="api-service/src/main/webapp/WEB-INF/web.xml" basedir="build/webapp/api-service"/>
    </target>

    <target name="war-api-service-proprietary" depends="webapp-api-service-proprietary">
        <mkdir dir="build/war-proprietary"/>
        <war destfile="build/war-proprietary/mcf-api-service.war" webxml="api-service/src/main/webapp/WEB-INF/web.xml" basedir="build/webapp/api-service-proprietary"/>
    </target>

    <target name="war-crawler-ui" depends="webapp-crawler-ui">
        <mkdir dir="build/war"/>
        <war destfile="build/war/mcf-crawler-ui.war" webxml="crawler-ui/src/main/webapp/WEB-INF/web.xml" basedir="build/webapp/crawler-ui"/>
    </target>

    <target name="war-crawler-ui-proprietary" depends="webapp-crawler-ui-proprietary">
        <mkdir dir="build/war-proprietary"/>
        <war destfile="build/war-proprietary/mcf-crawler-ui.war" webxml="crawler-ui/src/main/webapp/WEB-INF/web.xml" basedir="build/webapp/crawler-ui-proprietary"/>
    </target>

    <target name="war-combined-service" depends="webapp-combined-service">
        <mkdir dir="build/war"/>
        <war destfile="build/war/mcf-combined-service.war" webxml="combined-service/src/main/webapp/WEB-INF/web.xml" basedir="build/webapp/combined-service"/>
    </target>

    <target name="war-combined-service-proprietary" depends="webapp-combined-service-proprietary">
        <mkdir dir="build/war-proprietary"/>
        <war destfile="build/war-proprietary/mcf-combined-service.war" webxml="combined-service/src/main/webapp/WEB-INF/web.xml" basedir="build/webapp/combined-service-proprietary"/>
    </target>

    <target name="wars" depends="war-authority-service,war-api-service,war-crawler-ui,war-combined-service">
        <mkdir dir="dist/web/war"/>
        <copy todir="dist/web/war">
            <fileset dir="build/war"/>
        </copy>
    </target>

    <target name="wars-proprietary" depends="war-authority-service-proprietary,war-api-service-proprietary,war-crawler-ui-proprietary,war-combined-service-proprietary">
        <mkdir dir="dist/web-proprietary/war"/>
        <copy todir="dist/web-proprietary/war">
            <fileset dir="build/war-proprietary"/>
        </copy>
    </target>

    <target name="buildfiles">
        <mkdir dir="dist"/>
        <copy todir="dist">
            <fileset dir="buildfiles"/>
        </copy>
    </target>
    

    <target name="lib" depends="jar-core,jar-ui-core,jar-agents,jar-pull-agent,jar-jetty-runner,jar-script-engine">
        <mkdir dir="dist/lib"/>
        <copy todir="dist/lib">
            <fileset dir="../lib">
                <include name="zookeeper*.jar"/>
                <include name="netty-handler*.jar"/>
                <include name="json-simple*.jar"/>
                <include name="commons-codec*.jar"/>
                <include name="commons-collections*.jar"/>
                <include name="commons-collections4*.jar"/>
                <include name="commons-el*.jar"/>
                <include name="commons-fileupload2-*.jar"/>
                <include name="httpcore*.jar"/>
                <include name="httpclient*.jar"/>
                <include name="httpmime*.jar"/>                
                <include name="commons-discovery*.jar"/>
                <include name="commons-io*.jar"/>
                <include name="commons-lang*.jar"/>
                <include name="commons-logging*.jar"/>
                <include name="log4j-1.2.*.jar"/>
                <include name="log4j-api-*.jar"/>
                <include name="log4j-core-*.jar"/>
                <include name="log4j-1.2-api-*.jar"/>
                <include name="serializer*.jar"/>
                <include name="jakarta.servlet-api*.jar"/>
                <include name="jakarta.el-api*.jar"/>
                <include name="tomcat-*.jar"/>
                <include name="xalan*.jar"/>
                <include name="xercesImpl*.jar"/>
                <include name="xml-apis*.jar"/>
                <include name="ecj-*.jar"/>
                <include name="velocity*.jar"/>
                <include name="slf4j*.jar"/>
                <include name="jakarta.mail-api*.jar"/>
                <include name="commons-exec*.jar"/>
                <include name="gson*.jar"/>
                <include name="guava*.jar"/>
                <include name="jna*.jar"/>
            </fileset>
            <fileset dir="../lib">
                <include name="http2*.jar"/>
                <include name="jetty-*.jar"/>
                <include name="jakarta.servlet-api*.jar"/>
                <include name="jakarta.el-api*.jar"/>
                <include name="jakarta.servlet.jsp.jstl-*.jar"/>
                <include name="tomcat-*.jar"/>
                <include name="asm-*.jar"/>
                <include name="jasper*.jar"/>
                <include name="juli*.jar"/>
                <include name="jsp-api*.jar"/>
            </fileset>
            <fileset dir="../lib">
                <include name="jakarta.activation-api*.jar"/>
                <include name="jakarta.xml.bind-api*.jar"/>
                <include name="jakarta.xml.ws-api*.jar"/>
                <include name="jakarta.xml.soap-api*.jar"/>
                <include name="jakarta.annotation-api*.jar"/>
                <include name="jakarta.ws.rs-api*.jar"/>
                <include name="jakarta.jws-api*.jar"/>
                <include name="angus-activation*.jar"/>
            </fileset>
            <fileset dir="../lib">
                <include name="postgresql*.jar"/>
                <include name="hsqldb*.jar"/>
            </fileset>
            <fileset dir="build/jar">
                <include name="mcf-core.jar"/>
                <include name="mcf-ui-core.jar"/>
                <include name="mcf-agents.jar"/>
                <include name="mcf-pull-agent.jar"/>
                <include name="mcf-jetty-runner.jar"/>
                <include name="mcf-script-engine.jar"/>
            </fileset>
        </copy>
        <copy tofile="dist/lib/xercesImpl.jar">
            <fileset dir="../lib">
                <include name="xercesImpl-*.jar"/>
            </fileset>
        </copy>
        <copy tofile="dist/lib/xml-apis.jar">
            <fileset dir="../lib">
                <include name="xml-apis-*.jar"/>
            </fileset>
        </copy>
        <copy tofile="dist/lib/serializer.jar">
            <fileset dir="../lib">
                <include name="serializer-*.jar"/>
            </fileset>
        </copy>
    </target>
    
    <target name="lib-proprietary">
        <mkdir dir="dist/lib-proprietary"/>
        <copy todir="dist/lib-proprietary">
            <fileset dir="../lib-proprietary">
                <include name="mysql*.jar"/>
                <include name="ojdbc*.jar"/>
                <include name="jtds*.jar"/>
                <include name="mariadb-java-client*.jar"/>
            </fileset>
        </copy>
    </target>

    <target name="general-set-classpath">
        <replace file="${processes-dir}/options.env.win" token=".;" value=".;${win-classpath};"/>
        <replace file="${processes-dir}/options.env.unix" token=".:" value=".:${unix-classpath}:"/>
    </target>

    <target name="general-set-engine-classpath">
        <replace file="${processes-dir}/options.env.win" token=".;" value=".;${win-classpath};"/>
        <replace file="${processes-dir}/options.env.unix" token=".:" value=".:${unix-classpath}:"/>
    </target>

    <target name="general-set-obfuscate-classpath">
        <replace file="${processes-dir}/options.env.win" token=".;" value=".;${win-classpath};"/>
        <replace file="${processes-dir}/options.env.unix" token=".:" value=".:${unix-classpath}:"/>
    </target>

    <target name="general-set-jetty-classpath">
        <replace file="${processes-dir}/jetty-options.env.win" token=".;" value=".;${win-classpath};"/>
        <replace file="${processes-dir}/jetty-options.env.unix" token=".:" value=".:${unix-classpath}:"/>
    </target>

    <target name="general-set-hsqldb-classpath">
        <replace file="${processes-dir}/hsqldb-options.env.win" token=".;" value=".;${win-classpath};"/>
        <replace file="${processes-dir}/hsqldb-options.env.unix" token=".:" value=".:${unix-classpath}:"/>
    </target>

    <target name="general-set-zookeeper-classpath">
        <replace file="${processes-dir}/zk-options.env.win" token=".;" value=".;${win-classpath};"/>
        <replace file="${processes-dir}/zk-options.env.unix" token=".:" value=".:${unix-classpath}:"/>
    </target>

    <target name="general-set-combined-classpath">
        <replace file="${processes-dir}/combined-options.env.win" token=".;" value=".;${win-classpath};"/>
        <replace file="${processes-dir}/combined-options.env.unix" token=".:" value=".:${unix-classpath}:"/>
    </target>

    <target name="general-set-start-classpath">
        <replace file="${processes-dir}/start-options.env.win" token=".;" value=".;${win-classpath};"/>
        <replace file="${processes-dir}/start-options.env.unix" token=".:" value=".:${unix-classpath}:"/>
    </target>

    <target name="preclean-processes">
        <mkdir dir="${processes-dir}"/>
        <delete file="${processes-dir}/options.env.win"/>
        <delete file="${processes-dir}/options.env.unix"/>
    </target>

    <target name="preclean-obfuscate-processes">
        <mkdir dir="${processes-dir}"/>
        <delete file="${processes-dir}/options.env.win"/>
        <delete file="${processes-dir}/options.env.unix"/>
    </target>

    <target name="preclean-engine-processes">
        <mkdir dir="${processes-dir}"/>
        <delete file="${processes-dir}/options.env.win"/>
        <delete file="${processes-dir}/options.env.unix"/>
    </target>

    <target name="preclean-jetty-processes">
        <mkdir dir="${processes-dir}"/>
        <delete file="${processes-dir}/jetty-options.env.win"/>
        <delete file="${processes-dir}/jetty-options.env.unix"/>
    </target>

    <target name="preclean-hsqldb-processes">
        <mkdir dir="${processes-dir}"/>
        <delete file="${processes-dir}/hsqldb-options.env.win"/>
        <delete file="${processes-dir}/hsqldb-options.env.unix"/>
    </target>

    <target name="preclean-zookeeper-processes">
        <mkdir dir="${processes-dir}"/>
        <delete file="${processes-dir}/zk-options.env.win"/>
        <delete file="${processes-dir}/zk-options.env.unix"/>
    </target>

    <target name="preclean-combined-processes">
        <mkdir dir="${processes-dir}"/>
        <delete file="${processes-dir}/combined-options.env.win"/>
        <delete file="${processes-dir}/combined-options.env.unix"/>
    </target>

    <target name="preclean-start-processes">
        <mkdir dir="${processes-dir}"/>
        <delete file="${processes-dir}/start-options.env.win"/>
        <delete file="${processes-dir}/start-options.env.unix"/>
    </target>

    <target name="scripts-common">
        <mkdir dir="${processes-dir}"/>
        <copy todir="${processes-dir}">
            <fileset dir="scripts-common"/>
        </copy>
    </target>

    <target name="scripts-kerberos">
        <mkdir dir="${processes-dir}"/>
        <copy todir="${processes-dir}">
            <fileset dir="scripts-kerberos"/>
        </copy>
    </target>

    <target name="scripts" depends="scripts-common,scripts-kerberos">
        <mkdir dir="${processes-dir}"/>
        <copy todir="${processes-dir}">
            <fileset dir="scripts"/>
        </copy>
    </target>

    <target name="scripts-jetty" depends="scripts-common,scripts-kerberos">
        <mkdir dir="${processes-dir}"/>
        <copy todir="${processes-dir}">
            <fileset dir="scripts-jetty"/>
        </copy>
    </target>

    <target name="scripts-hsqldb" depends="scripts-common">
        <mkdir dir="${processes-dir}"/>
        <copy todir="${processes-dir}">
            <fileset dir="scripts-hsqldb"/>
        </copy>
    </target>

    <target name="scripts-zookeeper" depends="scripts-common">
        <mkdir dir="${processes-dir}"/>
        <copy todir="${processes-dir}">
            <fileset dir="scripts-zookeeper"/>
        </copy>
    </target>

    <target name="scripts-combined" depends="scripts-common,scripts-kerberos">
        <mkdir dir="${processes-dir}"/>
        <copy todir="${processes-dir}">
            <fileset dir="scripts-combined"/>
        </copy>
    </target>

    <target name="scripts-start" depends="scripts-common,scripts-kerberos">
        <mkdir dir="${processes-dir}"/>
        <copy todir="${processes-dir}">
            <fileset dir="scripts-start"/>
        </copy>
    </target>

    <target name="scripts-engine" depends="scripts-common">
        <mkdir dir="${processes-dir}"/>
        <copy todir="${processes-dir}">
            <fileset dir="engine-scripts"/>
        </copy>
    </target>

    <target name="scripts-obfuscate" depends="scripts-common">
        <mkdir dir="${processes-dir}"/>
        <copy todir="${processes-dir}">
            <fileset dir="obfuscate-scripts"/>
        </copy>
    </target>

    <!-- Paths, as used to construct script classpaths -->
    
    <path id="jetty-lib">
        <fileset dir="../lib">
          <include name="jetty-http2-*.jar"/>
          <include name="jetty-*.jar"/>
          <include name="jakarta.servlet-api*.jar"/>
          <include name="jakarta.annotation-api*.jar"/>
          <include name="jakarta.el-api*.jar"/>
          <include name="jakarta.servlet.jsp.jstl-*.jar"/>
          <include name="tomcat-*.jar"/>
          <include name="asm-*.jar"/>
        </fileset>
    </path>
    
    <path id="database-lib">
        <fileset dir="../lib">
            <include name="hsqldb*.jar"/>
            <include name="postgresql*.jar"/>
        </fileset>
    </path>
    
    <path id="hsqldb-lib">
        <fileset dir="../lib">
            <include name="hsqldb*.jar"/>
        </fileset>
    </path>
    
    <path id="zookeeper-lib">
        <fileset dir="../lib">
            <include name="zookeeper*.jar"/>
            <include name="netty-handler*.jar"/>
            <include name="slf4j-api*.jar"/>
            <include name="slf4j-simple*.jar"/>
            <include name="log4j-1.2.*.jar"/>
        </fileset>
    </path>
    
    <path id="process-lib">
          <fileset dir="../lib">
            <include name="commons-lang*.jar"/>
            <include name="commons-codec*.jar"/>
            <include name="commons-collections*.jar"/>
            <include name="commons-collections4*.jar"/>
            <include name="commons-el*.jar"/>
            <include name="commons-fileupload2-*.jar"/>
            <include name="commons-io*.jar"/>
            <include name="commons-logging*.jar"/>
            <include name="commons-discovery*.jar"/>
            <include name="jasper*.jar"/>
            <include name="jsp-api-2.1-glassfish*.jar"/>
            <include name="json-simple*.jar"/>
            <include name="log4j-api-*.jar"/>
            <include name="log4j-core-*.jar"/>
            <include name="log4j-1.2-api-*.jar"/>
            <include name="serializer*.jar"/>
            <include name="jakarta.servlet-api*.jar"/>
            <include name="jakarta.el-api*.jar"/>
            <include name="tomcat-*.jar"/>
            <include name="xalan*.jar"/>
            <include name="xercesImpl*.jar"/>
            <include name="xml-apis*.jar"/>
            <include name="ecj-*.jar"/>            <include name="ecj*.jar"/>
            <include name="velocity*.jar"/>
            <include name="slf4j-api*.jar"/>
            <include name="slf4j-simple*.jar"/>
            <include name="httpcore*.jar"/>
            <include name="httpclient*.jar"/>
            <include name="httpmime*.jar"/>            
            <include name="jakarta.mail-api*.jar"/>
            <include name="commons-exec*.jar"/>
            <include name="gson*.jar"/>
            <include name="guava*.jar"/>
            <include name="jna*.jar"/>
            <include name="zookeeper*.jar"/>
            <include name="netty-handler*.jar"/>
        </fileset>
        <fileset dir="../lib">
            <include name="jakarta.activation-api*.jar"/>
                <include name="angus-activation*.jar"/>
        </fileset>
    </path>
    
    <path id="process-lib-proprietary">
        <fileset dir="../lib-proprietary">
            <include name="mysql-connector-java*.jar"/>
            <include name="ojdbc*.jar"/>
            <include name="jtds*.jar"/>
            <include name="mariadb-java-client*.jar"/>
        </fileset>
    </path>
    
    <path id="engine-lib">
        <fileset dir="../lib">
            <include name="commons-lang*.jar"/>
            <include name="commons-codec*.jar"/>
            <include name="commons-collections*.jar"/>
            <include name="commons-io*.jar"/>
            <include name="commons-logging*.jar"/>
            <include name="json-simple*.jar"/>
            <include name="httpcore*.jar"/>
            <include name="httpclient*.jar"/>
        </fileset>
    </path>

    <path id="obfuscate-lib">
        <fileset dir="../lib">
            <include name="commons-logging*.jar"/>
        </fileset>
    </path>

    <!-- Classpaths -->
    
    <target name="jetty-lib-classpath" depends="lib">
        <property name="jetty-lib-classpath" location="../lib"/>
        <pathconvert property="jetty-lib-classpath-win" refid="jetty-lib" dirsep="\" pathsep=";">
            <map from="${jetty-lib-classpath}" to="..\lib"/>
        </pathconvert>
        <pathconvert property="jetty-lib-classpath-unix" refid="jetty-lib" dirsep="/" pathsep=":">
            <map from="${jetty-lib-classpath}" to="../lib"/>
        </pathconvert>
    </target>

    <target name="hsqldb-lib-classpath" depends="lib">
        <property name="hsqldb-lib-classpath" location="../lib"/>
        <pathconvert property="hsqldb-lib-classpath-win" refid="hsqldb-lib" dirsep="\" pathsep=";">
            <map from="${hsqldb-lib-classpath}" to="..\lib"/>
        </pathconvert>
        <pathconvert property="hsqldb-lib-classpath-unix" refid="hsqldb-lib" dirsep="/" pathsep=":">
            <map from="${hsqldb-lib-classpath}" to="../lib"/>
        </pathconvert>
    </target>

    <target name="zookeeper-lib-classpath" depends="lib">
        <property name="zookeeper-lib-classpath" location="../lib"/>
        <pathconvert property="zookeeper-lib-classpath-win" refid="zookeeper-lib" dirsep="\" pathsep=";">
            <map from="${zookeeper-lib-classpath}" to="..\lib"/>
        </pathconvert>
        <pathconvert property="zookeeper-lib-classpath-unix" refid="zookeeper-lib" dirsep="/" pathsep=":">
            <map from="${zookeeper-lib-classpath}" to="../lib"/>
        </pathconvert>
    </target>

    <target name="database-lib-classpath" depends="lib">
        <property name="database-lib-classpath" location="../lib"/>
        <pathconvert property="database-lib-classpath-win" refid="database-lib" dirsep="\" pathsep=";">
            <map from="${database-lib-classpath}" to="..\lib"/>
        </pathconvert>
        <pathconvert property="database-lib-classpath-unix" refid="database-lib" dirsep="/" pathsep=":">
            <map from="${database-lib-classpath}" to="../lib"/>
        </pathconvert>
    </target>

    <target name="process-lib-classpath" depends="lib">
        <property name="process-lib-classpath" location="../lib"/>
        <pathconvert property="process-lib-classpath-win" refid="process-lib" dirsep="\" pathsep=";">
            <map from="${process-lib-classpath}" to="..\lib"/>
        </pathconvert>
        <pathconvert property="process-lib-classpath-unix" refid="process-lib" dirsep="/" pathsep=":">
            <map from="${process-lib-classpath}" to="../lib"/>
        </pathconvert>
    </target>

    <target name="process-lib-proprietary-classpath" depends="lib-proprietary">
        <property name="process-lib-proprietary-classpath" location="../lib-proprietary"/>
        <pathconvert property="process-lib-proprietary-classpath-win" refid="process-lib-proprietary" dirsep="\" pathsep=";">
            <map from="${process-lib-proprietary-classpath}" to="..\lib-proprietary"/>
        </pathconvert>
        <pathconvert property="process-lib-proprietary-classpath-unix" refid="process-lib-proprietary" dirsep="/" pathsep=":">
            <map from="${process-lib-proprietary-classpath}" to="../lib-proprietary"/>
        </pathconvert>
    </target>

    <target name="engine-lib-classpath" depends="lib">
        <property name="engine-lib-classpath" location="../lib"/>
        <pathconvert property="engine-lib-classpath-win" refid="engine-lib" dirsep="\" pathsep=";">
            <map from="${engine-lib-classpath}" to="..\lib"/>
        </pathconvert>
        <pathconvert property="engine-lib-classpath-unix" refid="engine-lib" dirsep="/" pathsep=":">
            <map from="${engine-lib-classpath}" to="../lib"/>
        </pathconvert>
    </target>

    <target name="obfuscate-lib-classpath" depends="lib">
        <property name="obfuscate-lib-classpath" location="../lib"/>
        <pathconvert property="obfuscate-lib-classpath-win" refid="obfuscate-lib" dirsep="\" pathsep=";">
            <map from="${obfuscate-lib-classpath}" to="..\lib"/>
        </pathconvert>
        <pathconvert property="obfuscate-lib-classpath-unix" refid="obfuscate-lib" dirsep="/" pathsep=":">
            <map from="${obfuscate-lib-classpath}" to="../lib"/>
        </pathconvert>
    </target>

    <target name="jetty-lib-manifest" depends="lib">
        <property name="jetty-lib-manifest" location="../lib"/>
        <pathconvert property="jetty-manifest-cp" refid="jetty-lib" dirsep="/" pathsep=" ">
            <map from="${jetty-lib-manifest}" to="../lib"/>
        </pathconvert>
    </target>

    <target name="database-lib-manifest" depends="lib">
        <property name="database-lib-manifest" location="../lib"/>
        <pathconvert property="database-manifest-cp" refid="database-lib" dirsep="/" pathsep=" ">
            <map from="${database-lib-manifest}" to="../lib"/>
        </pathconvert>
    </target>

    <target name="process-lib-manifest" depends="lib">
        <property name="process-lib-manifest" location="../lib"/>
        <pathconvert property="process-manifest-cp" refid="process-lib" dirsep="/" pathsep=" ">
            <map from="${process-lib-manifest}" to="../lib"/>
        </pathconvert>
    </target>

    <target name="process-lib-proprietary-manifest" depends="lib-proprietary">
        <property name="process-manifest-proprietary" location="../lib-proprietary" />
        <pathconvert property="process-manifest-cp-proprietary" refid="process-lib-proprietary" dirsep="/" pathsep=" ">
            <map from="${process-manifest-proprietary}" to="../lib-proprietary"/>
        </pathconvert>
    </target>


    <!-- Apply classpaths to various scripts -->
    
    <target name="setup-obfuscate-processes" depends="preclean-obfuscate-processes,scripts-obfuscate,obfuscate-lib-classpath">
        <antcall target="general-set-obfuscate-classpath">
            <param name="processes-dir" value="${processes-dir}"/>
            <param name="win-classpath" value="..\lib\mcf-core.jar;${obfuscate-lib-classpath-win}"/>
            <param name="unix-classpath" value="../lib/mcf-core.jar:${obfuscate-lib-classpath-unix}"/>
        </antcall>
    </target>

    <target name="setup-engine-processes" depends="preclean-engine-processes,scripts-engine,engine-lib-classpath">
        <antcall target="general-set-engine-classpath">
            <param name="processes-dir" value="${processes-dir}"/>
            <param name="win-classpath" value="..\lib\mcf-core.jar;..\lib\mcf-script-engine.jar;${engine-lib-classpath-win}"/>
            <param name="unix-classpath" value="../lib/mcf-core.jar:../lib/mcf-script-engine.jar:${engine-lib-classpath-unix}"/>
        </antcall>
    </target>
    
    <target name="setup-jetty-processes" depends="preclean-jetty-processes,scripts-jetty,process-lib-classpath,jetty-lib-classpath">
        <antcall target="general-set-jetty-classpath">
            <param name="processes-dir" value="${processes-dir}"/>
            <param name="win-classpath" value="..\lib\mcf-core.jar;..\lib\mcf-agents.jar;..\lib\mcf-pull-agent.jar;..\lib\mcf-ui-core.jar;..\lib\mcf-jetty-runner.jar;${jetty-lib-classpath-win};${process-lib-classpath-win}"/>
            <param name="unix-classpath" value="../lib/mcf-core.jar:../lib/mcf-agents.jar:../lib/mcf-pull-agent.jar:../lib/mcf-ui-core.jar:../lib/mcf-jetty-runner.jar:${jetty-lib-classpath-unix}:${process-lib-classpath-unix}"/>
        </antcall>
    </target>

    <target name="setup-hsqldb-processes" depends="preclean-hsqldb-processes,scripts-hsqldb,hsqldb-lib-classpath">
        <antcall target="general-set-hsqldb-classpath">
            <param name="processes-dir" value="${processes-dir}"/>
            <param name="win-classpath" value="${hsqldb-lib-classpath-win}"/>
            <param name="unix-classpath" value="${hsqldb-lib-classpath-unix}"/>
        </antcall>
    </target>

    <target name="setup-zookeeper-processes" depends="preclean-zookeeper-processes,scripts-zookeeper,zookeeper-lib-classpath">
        <antcall target="general-set-zookeeper-classpath">
            <param name="processes-dir" value="${processes-dir}"/>
            <param name="win-classpath" value="${zookeeper-lib-classpath-win}"/>
            <param name="unix-classpath" value="${zookeeper-lib-classpath-unix}"/>
        </antcall>
    </target>

    <target name="setup-combined-processes" depends="preclean-combined-processes,scripts-combined,process-lib-classpath,jetty-lib-classpath">
        <antcall target="general-set-combined-classpath">
            <param name="processes-dir" value="${processes-dir}"/>
            <param name="win-classpath" value="..\lib\mcf-core.jar;..\lib\mcf-agents.jar;..\lib\mcf-pull-agent.jar;..\lib\mcf-ui-core.jar;..\lib\mcf-jetty-runner.jar;${jetty-lib-classpath-win};${process-lib-classpath-win}"/>
            <param name="unix-classpath" value="../lib/mcf-core.jar:../lib/mcf-agents.jar:../lib/mcf-pull-agent.jar:../lib/mcf-ui-core.jar:../lib/mcf-jetty-runner.jar:${jetty-lib-classpath-unix}:${process-lib-classpath-unix}"/>
        </antcall>
    </target>

    <target name="setup-start-processes" depends="preclean-start-processes,scripts-start,process-lib-classpath,database-lib-classpath,jetty-lib-classpath">
        <antcall target="general-set-start-classpath">
            <param name="processes-dir" value="${processes-dir}"/>
            <param name="win-classpath" value="..\lib\mcf-core.jar;..\lib\mcf-agents.jar;..\lib\mcf-pull-agent.jar;..\lib\mcf-ui-core.jar;..\lib\mcf-jetty-runner.jar;${jetty-lib-classpath-win};${database-lib-classpath-win};${process-lib-classpath-win}"/>
            <param name="unix-classpath" value="../lib/mcf-core.jar:../lib/mcf-agents.jar:../lib/mcf-pull-agent.jar:../lib/mcf-ui-core.jar:../lib/mcf-jetty-runner.jar:${jetty-lib-classpath-unix}:${database-lib-classpath-unix}:${process-lib-classpath-unix}"/>
        </antcall>
    </target>

    <target name="setup-processes" depends="preclean-processes,scripts,process-lib-classpath,database-lib-classpath">
        <antcall target="general-set-classpath">
            <param name="processes-dir" value="${processes-dir}"/>
            <param name="win-classpath" value="..\lib\mcf-core.jar;..\lib\mcf-agents.jar;..\lib\mcf-pull-agent.jar;${database-lib-classpath-win};${process-lib-classpath-win}"/>
            <param name="unix-classpath" value="../lib/mcf-core.jar:../lib/mcf-agents.jar:../lib/mcf-pull-agent.jar:${database-lib-classpath-unix}:${process-lib-classpath-unix}"/>
        </antcall>
    </target>

    <target name="setup-jetty-processes-proprietary" depends="setup-jetty-processes">
    </target>

    <target name="setup-hsqldb-processes-proprietary" depends="setup-hsqldb-processes">
    </target>

    <target name="setup-zookeeper-processes-proprietary" depends="setup-zookeeper-processes">
    </target>

    <target name="setup-combined-processes-proprietary" depends="setup-combined-processes">
    </target>

    <target name="setup-start-processes-proprietary" depends="preclean-start-processes,scripts-start,process-lib-classpath,process-lib-proprietary-classpath,database-lib-classpath,jetty-lib-classpath">
        <antcall target="general-set-start-classpath">
            <param name="processes-dir" value="${processes-dir}"/>
            <param name="win-classpath" value="..\lib\mcf-core.jar;..\lib\mcf-agents.jar;..\lib\mcf-pull-agent.jar;..\lib\mcf-ui-core.jar;..\lib\mcf-jetty-runner.jar;${jetty-lib-classpath-win};${database-lib-classpath-win};${process-lib-proprietary-classpath-win};${process-lib-classpath-win}"/>
            <param name="unix-classpath" value="../lib/mcf-core.jar:../lib/mcf-agents.jar:../lib/mcf-pull-agent.jar:../lib/mcf-ui-core.jar:../lib/mcf-jetty-runner.jar:${jetty-lib-classpath-unix}:${database-lib-classpath-unix}:${process-lib-proprietary-classpath-unix}:${process-lib-classpath-unix}"/>
        </antcall>
    </target>

    <target name="setup-processes-proprietary" depends="preclean-processes,scripts,process-lib-classpath,database-lib-classpath,process-lib-proprietary-classpath">
        <antcall target="general-set-classpath">
            <param name="processes-dir" value="${processes-dir}"/>
            <param name="win-classpath" value="..\lib\mcf-core.jar;..\lib\mcf-agents.jar;..\lib\mcf-pull-agent.jar;${database-lib-classpath-win};${process-lib-classpath-win};${process-lib-proprietary-classpath-win}"/>
            <param name="unix-classpath" value="../lib/mcf-core.jar:../lib/mcf-agents.jar:../lib/mcf-pull-agent.jar:${database-lib-classpath-unix}:${process-lib-classpath-unix}:${process-lib-proprietary-classpath-unix}"/>
        </antcall>
    </target>

    <!-- Set up connector-common-lib -->
    
    <target name="connector-common-lib" depends="jar-connector-common">
        <mkdir dir="dist/connector-common-lib"/>
        <copy todir="dist/connector-common-lib">
            <fileset dir="build/jar">
                <include name="mcf-connector-common.jar"/>
            </fileset>
            <fileset dir="../lib">
                <include name="tika-core*.jar"/>
                <include name="jackson-core*.jar"/>
                <include name="jackson-databind*.jar"/>
                <include name="jackson-annotations*.jar"/>
                <include name="tika-parsers*.jar"/>
                <include name="woodstox-core-5*.jar"/>
                <include name="stax2-api*.jar"/>
                <include name="json-1*.jar"/>
                <include name="poi*.jar"/>
                <include name="dom4j*.jar"/>
                <include name="xmlbeans*.jar"/>
                <include name="curvesapi*.jar"/>
                <include name="geoapi*.jar"/>
                <include name="jsr-275*.jar"/>
                <include name="sis-metadata*.jar"/>
                <include name="sis-utility*.jar"/>
                <include name="sis-netcdf*.jar"/>
                <include name="sis-storage*.jar"/>
                <include name="sis-feature*.jar"/>
                <include name="unit-api*.jar"/>
                <include name="opennlp-tools*.jar"/>
                <include name="openjson*.jar"/>
                <include name="jackcess*.jar"/>
                <include name="junrar*.jar"/>
                <include name="commons-vfs2*.jar"/>
                <include name="maven-scm*.jar"/>
                <include name="regexp*.jar"/>
                <include name="commons-csv*.jar"/>
                <include name="netcdf4*.jar"/>
                <include name="httpservices*.jar"/>
                <include name="grib*.jar"/>
                <include name="jj2000*.jar"/>
                <include name="cdm*.jar"/>
                <include name="udunits*.jar"/>
                <include name="jcommander*.jar"/>
                <include name="jcip-annotations*.jar"/>
                <include name="ehcache-core*.jar"/>
                <include name="bzip2*.jar"/>
                <include name="jdom2*.jar"/>
                <include name="jbig2-imageio*.jar"/>
                <include name="jai-imageio-core*.jar"/>
                <include name="quartz*.jar"/>
                <include name="c3p0*.jar"/>
                <include name="sentiment-analysis-parser*.jar"/>
                <include name="uimafit-core*.jar"/>
                <include name="uimaj-core*.jar"/>
                <include name="tagsoup*.jar"/>
                <include name="vorbis-java*.jar"/>
                <include name="netcdf*.jar"/>
                <include name="unidataCommon*.jar"/>
                <include name="commons-httpclient*.jar"/>
                <include name="apache-mime4j-core*.jar"/>
                <include name="apache-mime4j-dom*.jar"/>
                <include name="commons-compress*.jar"/>
                <include name="pdfbox*.jar"/>
                <include name="fontbox*.jar"/>
                <include name="jempbox*.jar"/>
                <include name="xmpbox*.jar"/>
                <include name="preflight*.jar"/>
                <include name="kafka*.jar"/>
                <include name="zookeeper*.jar"/>
                <include name="netty-handler*.jar"/>
                <include name="bcmail-jdk15*.jar"/>
                <include name="bcutil-jdk15*.jar"/>
                <include name="bcprov-jdk15*.jar"/>
                <include name="bcpkix-jdk15*.jar"/>
                <include name="SparseBitSet*.jar"/>
                <include name="HikariCP-java7*.jar"/>
                <include name="geronimo-stax-api_1.0_spec*.jar"/>
                <include name="asm*.jar"/>
                <include name="isoparser*.jar"/>
                <include name="aspectjrt*.jar"/>
                <include name="xmpcore*.jar"/>
                <include name="mchange-commons-java*.jar"/>
                <include name="dd-plist*.jar"/>
                <include name="xml-apis*.jar"/>
                <include name="boilerpipe*.jar"/>
                <include name="rome*.jar"/>
                <include name="jdom*.jar"/>
                <include name="xercesImpl*.jar"/>
                <include name="vorbis-java-core*.jar"/>
                <include name="juniversalchardet*.jar"/>
                <include name="jhighlight*.jar"/>
                <include name="jmatio*.jar"/>
                <include name="metadata-extractor*.jar"/>
                <include name="java-libpst*.jar"/>
                <include name="xz*.jar"/>
                <include name="parso*.jar"/>
                <include name="dec*.jar"/>
                <include name="cxf-*.jar"/>
                <include name="policy*.jar"/>
                <include name="gmbal*.jar"/>
                <include name="pfl-*.jar"/>
                <include name="management-api*.jar"/>
                <include name="stax-ex*.jar"/>
                <include name="ha-api*.jar"/>
                <include name="neethi*.jar"/>
                <include name="xml-resolver*.jar"/>
                <include name="xmlschema-core*.jar"/>
                <include name="jakarta.*.jar"/>
                <include name="jaxb*.jar"/>
            <include name="jakarta.xml.bind-api*.jar"/>
	      <include name="xsom*.jar"/>
	      <include name="codemodel*.jar"/>
	      <include name="rngom*.jar"/>
	      <include name="dtd-parser*.jar"/>
	      <include name="ant*.jar"/>
	      <include name="relaxng-datatype*.jar"/>
                <include name="txw2*.jar"/>
                <include name="istack-commons*.jar"/>
                <include name="FastInfoset*.jar"/>
                <include name="velocity-engine-core*.jar"/>
                <include name="jakarta.xml.ws-api*.jar"/>
                <include name="jakarta.annotation-api*.jar"/>
                <include name="jakarta.jws-api*.jar"/>
            </fileset>
            <fileset dir="../lib">
                <include name="castor*.jar"/>
                <include name="geronimo-javamail_1.4_spec*.jar"/>
                <include name="commons-discovery*.jar"/>
                <include name="axis*.jar"/>
                <include name="wss4j*.jar"/>
                <include name="saaj*.jar"/>
                <include name="wsdl4j*.jar"/>
                <include name="xmlsec*.jar"/>
                <include name="opensaml*.jar"/>
                <!--include name="activation*.jar"/-->
            </fileset>
        </copy>
    </target>
    
    <!-- Set up example directories -->
    
    <target name="example-common" depends="wars,wars-proprietary,connector-common-lib">
        <copy file="example-common/connectors.xml" tofile="dist/connectors.xml"/>
        <copy file="example-common/connectors.xml" tofile="dist/connectors-proprietary.xml"/>
        <mkdir dir="dist/connector-lib"/>
        <mkdir dir="dist/connector-lib-proprietary"/>
        <copy file="example-common/README.txt" todir="dist/connector-lib-proprietary"/>
    </target>
    
    <target name="multi-processes-file" depends="lib">
        <antcall target="setup-processes">
            <param name="processes-dir" value="dist/multiprocess-file-example"/>
        </antcall>
        <mkdir dir="dist/multiprocess-file-example/syncharea"/>
    </target>

    <target name="multi-processes-file-proprietary" depends="lib,lib-proprietary">
        <antcall target="setup-processes-proprietary">
            <param name="processes-dir" value="dist/multiprocess-file-example-proprietary"/>
        </antcall>
        <mkdir dir="dist/multiprocess-file-example-proprietary/syncharea"/>
    </target>

    <target name="multi-processes-zk" depends="lib">
        <antcall target="setup-processes">
            <param name="processes-dir" value="dist/multiprocess-zk-example"/>
        </antcall>
        <mkdir dir="dist/multiprocess-zk-example/zookeeper"/>
    </target>

    <target name="multi-processes-zk-proprietary" depends="lib,lib-proprietary">
        <antcall target="setup-processes-proprietary">
            <param name="processes-dir" value="dist/multiprocess-zk-example-proprietary"/>
        </antcall>
        <mkdir dir="dist/multiprocess-zk-example-proprietary/zookeeper"/>
    </target>

    <target name="multi-process-file-example" depends="lib,multi-processes-file">
        <antcall target="setup-jetty-processes">
            <param name="processes-dir" value="dist/multiprocess-file-example"/>
        </antcall>
        <antcall target="setup-hsqldb-processes">
            <param name="processes-dir" value="dist/multiprocess-file-example"/>
        </antcall>

        <mkdir dir="dist/multiprocess-file-example"/>
        <copy todir="dist/multiprocess-file-example">
            <fileset dir="example-multiprocess-common">
                <include name="*.sh"/>
                <include name="*.bat"/>
                <include name="*.xml"/>
            </fileset>
            <fileset dir="example-multiprocess-file-common">
                <include name="*.sh"/>
                <include name="*.bat"/>
            </fileset>
            <fileset dir="example-multiprocess-file">
                <include name="properties.xml"/>
            </fileset>
        </copy>
        <replace file="dist/multiprocess-file-example/properties.xml" token="unknown version" value="${release-version}"/>
        
        <mkdir dir="dist/multiprocess-file-example/logs"/>
        <chmod dir="dist/multiprocess-file-example" perm="a+x" includes="**/*.sh"/>
    </target>
  
      <target name="multi-process-file-example-proprietary" depends="lib,lib-proprietary,multi-processes-file-proprietary">
        <antcall target="setup-jetty-processes-proprietary">
            <param name="processes-dir" value="dist/multiprocess-file-example-proprietary"/>
        </antcall>
        <antcall target="setup-hsqldb-processes-proprietary">
            <param name="processes-dir" value="dist/multiprocess-file-example-proprietary"/>
        </antcall>
        <mkdir dir="dist/multiprocess-file-example-proprietary"/>
        <copy todir="dist/multiprocess-file-example-proprietary">
            <fileset dir="example-multiprocess-common">
                <include name="*.sh"/>
                <include name="*.bat"/>
                <include name="*.xml"/>
            </fileset>
            <fileset dir="example-multiprocess-file-common">
                <include name="*.sh"/>
                <include name="*.bat"/>
            </fileset>
            <fileset dir="example-multiprocess-file-proprietary">
                <include name="properties.xml"/>
            </fileset>
        </copy>
        <replace file="dist/multiprocess-file-example-proprietary/properties.xml" token="unknown version" value="${release-version}"/>
        <mkdir dir="dist/multiprocess-file-example-proprietary/logs"/>
        <chmod dir="dist/multiprocess-file-example-proprietary" perm="a+x" includes="**/*.sh"/>
    </target>

    <target name="multi-process-zk-example" depends="lib,multi-processes-zk">
        <antcall target="setup-jetty-processes">
            <param name="processes-dir" value="dist/multiprocess-zk-example"/>
        </antcall>
        <antcall target="setup-hsqldb-processes">
            <param name="processes-dir" value="dist/multiprocess-zk-example"/>
        </antcall>
        <antcall target="setup-zookeeper-processes">
            <param name="processes-dir" value="dist/multiprocess-zk-example"/>
        </antcall>
        <mkdir dir="dist/multiprocess-zk-example"/>
        <copy todir="dist/multiprocess-zk-example">
            <fileset dir="example-multiprocess-common">
                <include name="*.sh"/>
                <include name="*.bat"/>
                <include name="*.xml"/>
            </fileset>
            <fileset dir="example-multiprocess-zk-common">
                <include name="*.sh"/>
                <include name="*.bat"/>
                <include name="*.cfg"/>
                <include name="*.xml"/>
            </fileset>
            <fileset dir="example-multiprocess-zk">
                <include name="properties.xml"/>
            </fileset>
        </copy>
        <replace file="dist/multiprocess-zk-example/properties-global.xml" token="unknown version" value="${release-version}"/>
        <mkdir dir="dist/multiprocess-zk-example/logs"/>
        <chmod dir="dist/multiprocess-zk-example" perm="a+x" includes="**/*.sh"/>
    </target>
  
      <target name="multi-process-zk-example-proprietary" depends="lib,lib-proprietary,multi-processes-zk-proprietary">
        <antcall target="setup-jetty-processes-proprietary">
            <param name="processes-dir" value="dist/multiprocess-zk-example-proprietary"/>
        </antcall>
        <antcall target="setup-hsqldb-processes-proprietary">
            <param name="processes-dir" value="dist/multiprocess-zk-example-proprietary"/>
        </antcall>
        <antcall target="setup-zookeeper-processes-proprietary">
            <param name="processes-dir" value="dist/multiprocess-zk-example-proprietary"/>
        </antcall>
        <mkdir dir="dist/multiprocess-zk-example-proprietary"/>
        <copy todir="dist/multiprocess-zk-example-proprietary">
            <fileset dir="example-multiprocess-common">
                <include name="*.sh"/>
                <include name="*.bat"/>
                <include name="*.xml"/>
            </fileset>
            <fileset dir="example-multiprocess-zk-common">
                <include name="*.sh"/>
                <include name="*.bat"/>
                <include name="*.cfg"/>
                <include name="*.xml"/>
            </fileset>
            <fileset dir="example-multiprocess-zk-proprietary">
                <include name="properties.xml"/>
            </fileset>
        </copy>
        <replace file="dist/multiprocess-zk-example-proprietary/properties-global.xml" token="unknown version" value="${release-version}"/>
        <mkdir dir="dist/multiprocess-zk-example-proprietary/logs"/>
        <chmod dir="dist/multiprocess-zk-example-proprietary" perm="a+x" includes="**/*.sh"/>
    </target>

    <target name="obfuscation-utility" depends="lib">
        <antcall target="setup-obfuscate-processes">
            <param name="processes-dir" value="dist/obfuscation-utility"/>
        </antcall>
        <chmod dir="dist/obfuscation-utility" perm="a+x" includes="**/*.sh"/>
    </target>
    
    <target name="script-engine" depends="lib">
        <antcall target="setup-engine-processes">
            <param name="processes-dir" value="dist/script-engine"/>
        </antcall>
        <copy todir="dist/script-engine">
            <fileset dir="script-example"/>
        </copy>
        <chmod dir="dist/script-engine" perm="a+x" includes="**/*.sh"/>
    </target>
    
    <target name="single-process-start-jar" depends="process-lib-manifest,jetty-lib-manifest,database-lib-manifest">
        <mkdir dir="build/example"/>
        <manifest file="build/example/manifest">
            <attribute name="Main-Class" value="org.apache.manifoldcf.jettyrunner.ManifoldCFJettyRunner"/>
            <attribute name="Class-Path" value="../lib/mcf-core.jar ../lib/mcf-agents.jar ../lib/mcf-pull-agent.jar ../lib/mcf-ui-core.jar ../lib/mcf-jetty-runner.jar ${database-manifest-cp} ${process-manifest-cp} ${jetty-manifest-cp}"/>
        </manifest>
        <jar destfile="dist/example/start.jar" manifest="build/example/manifest"/>
    </target>
    
    <target name="single-process-example" depends="single-process-start-jar">
        <antcall target="setup-combined-processes">
            <param name="processes-dir" value="dist/example"/>
        </antcall>
        <antcall target="setup-start-processes">
            <param name="processes-dir" value="dist/example"/>
        </antcall>
        <mkdir dir="dist/example/logs"/>
        <copy todir="dist/example">
            <fileset dir="example-singleprocess-common">
                <include name="*.sh"/>
                <include name="*.bat"/>
                <include name="*.xml"/>
            </fileset>
            <fileset dir="example-singleprocess">
                <include name="properties.xml"/>
            </fileset>
        </copy>
        <replace file="dist/example/properties.xml" token="unknown version" value="${release-version}"/>

        <chmod dir="dist/example" perm="a+x" includes="**/*.sh"/>

    </target>

    <target name="single-process-start-jar-proprietary" depends="process-lib-manifest,jetty-lib-manifest,process-lib-proprietary-manifest,database-lib-manifest">
        <mkdir dir="build/example-proprietary"/>
        <manifest file="build/example-proprietary/manifest">
            <attribute name="Main-Class" value="org.apache.manifoldcf.jettyrunner.ManifoldCFJettyRunner"/>
            <attribute name="Class-Path" value="../lib/mcf-core.jar ../lib/mcf-agents.jar ../lib/mcf-pull-agent.jar ../lib/mcf-ui-core.jar ../lib/mcf-jetty-runner.jar ${database-manifest-cp} ${process-manifest-cp} ${jetty-manifest-cp} ${process-manifest-cp-proprietary}"/>
        </manifest>
        <jar destfile="dist/example-proprietary/start.jar" manifest="build/example-proprietary/manifest"/>
    </target>
    
    <target name="single-process-example-proprietary" depends="single-process-start-jar-proprietary">
        <antcall target="setup-combined-processes-proprietary">
            <param name="processes-dir" value="dist/example-proprietary"/>
        </antcall>
        <antcall target="setup-start-processes-proprietary">
            <param name="processes-dir" value="dist/example-proprietary"/>
        </antcall>
        <mkdir dir="dist/example-proprietary/logs"/>
        <copy todir="dist/example-proprietary">
            <fileset dir="example-singleprocess-common">
                <include name="*.sh"/>
                <include name="*.bat"/>
                <include name="*.xml"/>
            </fileset>
            <fileset dir="example-singleprocess-proprietary">
                <include name="properties.xml"/>
            </fileset>
        </copy>
        <replace file="dist/example-proprietary/properties.xml" token="unknown version" value="${release-version}"/>

        <chmod dir="dist/example-proprietary" perm="a+x" includes="**/*.sh"/>
    </target>

    <target name="compile-core-tests" depends="compile-core">
        <mkdir dir="build/core-tests/classes"/>
        <javac srcdir="core/src/test/java" destdir="build/core-tests/classes" deprecation="true" target="21" source="21" debug="true" encoding="utf-8" debuglevel="lines,vars,source">
            <classpath>
                <path refid="framework-classpath"/>
                <pathelement location="build/core/classes"/>
            </classpath>
        </javac>
    </target>

    <target name="compile-connector-common-tests" depends="compile-connector-common">
        <mkdir dir="build/connector-common-tests/classes"/>
        <javac srcdir="connector-common/src/test/java" destdir="build/connector-common-tests/classes" deprecation="true" target="21" source="21" debug="true" encoding="utf-8" debuglevel="lines,vars,source">
            <classpath>
                <path refid="framework-classpath"/>
                <pathelement location="build/core/classes"/>
                <pathelement location="build/core-tests/classes"/>
                <pathelement location="build/connector-common/classes"/>
            </classpath>
        </javac>
    </target>

    <target name="compile-agents-tests" depends="compile-core-tests,compile-agents">
        <mkdir dir="build/agents-tests/classes"/>
        <javac srcdir="agents/src/test/java" destdir="build/agents-tests/classes" deprecation="true" target="21" source="21" debug="true" encoding="utf-8" debuglevel="lines,vars,source">
            <classpath>
                <path refid="framework-classpath"/>
                <pathelement location="build/core/classes"/>
                <pathelement location="build/core-tests/classes"/>
                <pathelement location="build/agents/classes"/>
            </classpath>
        </javac>
    </target>

    <target name="compile-pull-agent-tests" depends="compile-agents-tests,compile-pull-agent">
        <mkdir dir="build/pull-agent-tests/classes"/>
        <javac srcdir="pull-agent/src/test/java" destdir="build/pull-agent-tests/classes" deprecation="true" target="21" source="21" debug="true" encoding="utf-8" debuglevel="lines,vars,source">
            <classpath>
                <path refid="framework-classpath"/>
                <pathelement location="build/core/classes"/>
                <pathelement location="build/core-tests/classes"/>
                <pathelement location="build/agents/classes"/>
                <pathelement location="build/agents-tests/classes"/>
                <pathelement location="build/pull-agent/classes"/>
            </classpath>
        </javac>
    </target>

    <target name="compile-script-engine-tests" depends="compile-core,compile-script-engine">
        <mkdir dir="build/script-engine-tests/classes"/>
        <javac srcdir="script-engine/src/test/java" destdir="build/script-engine-tests/classes" deprecation="true" target="21" source="21" debug="true" encoding="utf-8" debuglevel="lines,vars,source">
            <classpath>
                <path refid="framework-classpath"/>
                <pathelement location="build/core/classes"/>
                <pathelement location="build/script-engine/classes"/>
            </classpath>
        </javac>
    </target>

    <target name="compile-tests" depends="compile-core-tests,compile-agents-tests,compile-pull-agent-tests,compile-script-engine-tests"/>
    
    <target name="jar-core-tests" depends="compile-core-tests">
        <mkdir dir="build/test-jar"/>
        <jar destfile="build/test-jar/mcf-core-tests.jar">
          <fileset dir="build/core-tests/classes"/>
          <fileset dir="core/src/test/resources"/>
        </jar>
    </target>

    <target name="jar-agents-tests" depends="compile-agents-tests">
        <mkdir dir="build/test-jar"/>
        <jar destfile="build/test-jar/mcf-agents-tests.jar" basedir="build/agents-tests/classes"/>
    </target>

    <target name="jar-pull-agent-tests" depends="compile-pull-agent-tests">
        <mkdir dir="build/test-jar"/>
        <jar destfile="build/test-jar/mcf-pull-agent-tests.jar" basedir="build/pull-agent-tests/classes"/>
    </target>

    <target name="jar-script-engine-tests" depends="compile-script-engine-tests">
        <mkdir dir="build/test-jar"/>
        <jar destfile="build/test-jar/mcf-script-engine-tests.jar" basedir="build/script-engine-tests/classes"/>
    </target>

    <target name="jar-tests" depends="jar-core-tests,jar-agents-tests,jar-pull-agent-tests,jar-script-engine-tests"/>

    <target name="test-lib" depends="jar-tests">
        <mkdir dir="dist/test-lib"/>
        <copy todir="dist/test-lib">
            <fileset dir="../lib">
                <include name="junit*.jar"/>
                <include name="selenium*.jar"/>
                <include name="okhttp*.jar"/>
                <include name="okio*.jar"/>
                <include name="byte-buddy*.jar"/>
                <include name="cglib-nodep*.jar"/>
                <include name="hamcrest-core*.jar"/>
                <include name="mockito-core*.jar"/>
                <include name="wiremock*.jar"/>
                <include name="objenesis*.jar"/>
                <include name="juli*.jar"/>
            </fileset>
            <fileset dir="build/test-jar">
                <include name="mcf-core-tests.jar"/>
                <include name="mcf-agents-tests.jar"/>
                <include name="mcf-pull-agent-tests.jar"/>
                <include name="mcf-script-engine-tests.jar"/>
            </fileset>
        </copy>
    </target>

    <target name="build-tests" depends="jar-tests"/>

    <target name="run-core-tests" depends="compile-core,compile-core-tests">
        <mkdir dir="test-output"/>
        <junit fork="true" maxmemory="128m" dir="test-output" outputtoformatters="true" showoutput="true" haltonfailure="true">
    <jvmarg value="-Djava.io.tmpdir=build/tmp"/>
            <classpath>
                <path refid="framework-classpath"/>
                <pathelement location="build/core/classes"/>
                <pathelement location="build/core-tests/classes"/>
            </classpath>
            <formatter type="brief" usefile="false"/>

            <test name="org.apache.manifoldcf.core.common.DateTest" todir="test-output"/>
            <test name="org.apache.manifoldcf.core.lockmanager.TestZooKeeperLocks" todir="test-output"/>
            <test name="org.apache.manifoldcf.core.interfaces.ConfigurationTest" todir="test-output"/>

        </junit>
    </target>

    <target name="run-connector-common-tests" depends="compile-connector-common,compile-connector-common-tests,compile-core,compile-core-tests">
        <mkdir dir="test-output"/>
        <junit fork="true" maxmemory="128m" dir="test-output" outputtoformatters="true" showoutput="true" haltonfailure="true">
    <jvmarg value="-Djava.io.tmpdir=build/tmp"/>
            <classpath>
                <path refid="framework-classpath"/>
                <pathelement location="build/core/classes"/>
                <pathelement location="build/core-tests/classes"/>
                <pathelement location="build/connector-common/classes"/>
                <pathelement location="build/connector-common-tests/classes"/>
            </classpath>
            <formatter type="brief" usefile="false"/>

            <test name="org.apache.manifoldcf.connectorcommon.fuzzyml.TestFuzzyML" todir="test-output"/>
            <test name="org.apache.manifoldcf.connectorcommon.jsongen.TestJsonGen" todir="test-output"/>
            <test name="org.apache.manifoldcf.connectorcommon.throttler.TestThrottler" todir="test-output"/>

        </junit>
    </target>

    <target name="run-pull-agent-tests" depends="compile-pull-agent,compile-connector-common,compile-pull-agent-tests">
        <mkdir dir="test-output"/>
        <junit fork="true" maxmemory="128m" dir="test-output" outputtoformatters="true" showoutput="true" haltonfailure="true">
    <jvmarg value="-Djava.io.tmpdir=build/tmp"/>
            <classpath>
                <path refid="framework-classpath"/>
                <pathelement location="build/core/classes"/>
                <pathelement location="build/core-tests/classes"/>
                <pathelement location="build/ui-core/classes"/>                
                <pathelement location="build/agents/classes"/>
                <pathelement location="build/agents-tests/classes"/>
                <pathelement location="build/pull-agent/classes"/>
                <pathelement location="build/pull-agent-tests/classes"/>
                <pathelement location="build/connector-common/classes"/>
            </classpath>
            <formatter type="brief" usefile="false"/>

            <test name="org.apache.manifoldcf.crawler.tests.ConnectionChangeHSQLDBTest" todir="test-output"/>
            <test name="org.apache.manifoldcf.crawler.tests.SchedulerHSQLDBTest" todir="test-output"/>
            <test name="org.apache.manifoldcf.crawler.tests.InterruptionHSQLDBTest" todir="test-output"/>

        </junit>
    </target>

    <target name="run-script-engine-tests" depends="compile-core,compile-script-engine,compile-script-engine-tests">
        <mkdir dir="test-output"/>
        <junit fork="true" maxmemory="128m" dir="test-output" outputtoformatters="true" showoutput="true" haltonfailure="true">
    <jvmarg value="-Djava.io.tmpdir=build/tmp"/>
            <classpath>
                <path refid="framework-classpath"/>
                <pathelement location="build/core/classes"/>
                <pathelement location="build/script-engine/classes"/>
                <pathelement location="build/script-engine-tests/classes"/>
            </classpath>
            <formatter type="brief" usefile="false"/>

            <test name="org.apache.manifoldcf.scriptengine.tests.ExpressionTest" todir="test-output"/>
            <test name="org.apache.manifoldcf.scriptengine.tests.CommandTest" todir="test-output"/>
            
        </junit>
    </target>

    <target name="run-UI-tests" depends="jar-core-tests">
        <mkdir dir="test-output"/>
        <junit fork="true" maxmemory="128m" dir="test-output" outputtoformatters="true" showoutput="true" haltonfailure="true">
    <jvmarg value="-Djava.io.tmpdir=build/tmp"/>
            <classpath>
                <path refid="framework-classpath"/>
                <fileset dir="build/test-jar">
                    <include name="mcf-core-tests.jar"/>
                </fileset>
            </classpath>
            <formatter type="brief" usefile="false"/>

            <test name="org.apache.manifoldcf.core.tests.HTMLTester" todir="test-output"/>
            
        </junit>
    </target>

    <target name="run-tests" depends="compile-tests,run-core-tests,run-connector-common-tests,run-pull-agent-tests,run-script-engine-tests"/>

    <target name="run-tests-postgresql" depends="compile-tests">
        <mkdir dir="test-postgresql-output"/>
        <junit fork="true" maxmemory="128m" dir="test-postgresql-output" outputtoformatters="true" showoutput="true" haltonfailure="true">
    <jvmarg value="-Djava.io.tmpdir=build/tmp"/>
            <classpath>
                <path refid="framework-classpath"/>
                <pathelement location="build/core/classes"/>
                <pathelement location="build/ui-core/classes"/>
                <pathelement location="build/agents/classes"/>
                <pathelement location="build/pull-agent/classes"/>
                <pathelement location="build/connector-common/classes"/>
                <pathelement location="build/authority-servlet/classes"/>
                <pathelement location="build/api-servlet/classes"/>
                <pathelement location="build/core-tests/classes"/>
                <pathelement location="build/agents-tests/classes"/>
                <pathelement location="build/pull-agent-tests/classes"/>
            </classpath>
            <formatter type="brief" usefile="false"/>

            <test name="org.apache.manifoldcf.agents.tests.SanityPostgresqlTest" todir="test-postgresql-output"/>
            <test name="org.apache.manifoldcf.crawler.tests.SanityPostgresqlTest" todir="test-postgresql-output"/>
            <!-- MHL -->
        </junit>
    </target>

    <target name="run-tests-mysql" depends="compile-tests">
        <mkdir dir="test-mysql-output"/>
        <junit fork="true" maxmemory="128m" dir="test-mysql-output" outputtoformatters="true" showoutput="true" haltonfailure="true">
    <jvmarg value="-Djava.io.tmpdir=build/tmp"/>
            <classpath>
                <path refid="framework-classpath"/>
                <pathelement location="build/core/classes"/>
                <pathelement location="build/ui-core/classes"/>
                <pathelement location="build/agents/classes"/>
                <pathelement location="build/pull-agent/classes"/>
                <pathelement location="build/connector-common/classes"/>
                <pathelement location="build/authority-servlet/classes"/>
                <pathelement location="build/api-servlet/classes"/>
                <pathelement location="build/core-tests/classes"/>
                <pathelement location="build/agents-tests/classes"/>
                <pathelement location="build/pull-agent-tests/classes"/>
            </classpath>
            <formatter type="brief" usefile="false"/>

            <test name="org.apache.manifoldcf.agents.tests.SanityMySQLTest" todir="test-mysql-output"/>
            <test name="org.apache.manifoldcf.crawler.tests.SanityMySQLTest" todir="test-mysql-output"/>
            <!-- MHL -->
        </junit>
    </target>

    <target name="run-tests-HSQLDB" depends="compile-tests">
        <mkdir dir="test-HSQLDB-output"/>
        <junit fork="true" maxmemory="128m" dir="test-HSQLDB-output" outputtoformatters="true" showoutput="true" haltonfailure="true">
    <jvmarg value="-Djava.io.tmpdir=build/tmp"/>
            <classpath>
                <path refid="framework-classpath"/>
                <pathelement location="build/core/classes"/>
                <pathelement location="build/ui-core/classes"/>
                <pathelement location="build/agents/classes"/>
                <pathelement location="build/pull-agent/classes"/>
                <pathelement location="build/connector-common/classes"/>
                <pathelement location="build/authority-servlet/classes"/>
                <pathelement location="build/api-servlet/classes"/>
                <pathelement location="build/core-tests/classes"/>
                <pathelement location="build/agents-tests/classes"/>
                <pathelement location="build/pull-agent-tests/classes"/>
            </classpath>
            <formatter type="brief" usefile="false"/>

            <test name="org.apache.manifoldcf.agents.tests.SanityHSQLDBTest" todir="test-HSQLDB-output"/>
            <test name="org.apache.manifoldcf.crawler.tests.SanityHSQLDBTest" todir="test-HSQLDB-output"/>

            <!-- MHL -->
        </junit>
    </target>

    <target name="run-tests-HSQLDBext" depends="compile-tests">
        <mkdir dir="test-HSQLDBext-output"/>
        <junit fork="true" maxmemory="128m" dir="test-HSQLDBext-output" outputtoformatters="true" showoutput="true" haltonfailure="true">
    <jvmarg value="-Djava.io.tmpdir=build/tmp"/>
            <classpath>
                <path refid="framework-classpath"/>
                <pathelement location="build/core/classes"/>
                <pathelement location="build/ui-core/classes"/>
                <pathelement location="build/agents/classes"/>
                <pathelement location="build/pull-agent/classes"/>
                <pathelement location="build/connector-common/classes"/>
                <pathelement location="build/authority-servlet/classes"/>
                <pathelement location="build/api-servlet/classes"/>
                <pathelement location="build/core-tests/classes"/>
                <pathelement location="build/agents-tests/classes"/>
                <pathelement location="build/pull-agent-tests/classes"/>
            </classpath>
            <formatter type="brief" usefile="false"/>

            <test name="org.apache.manifoldcf.agents.tests.SanityHSQLDBextTest" todir="test-HSQLDBext-output"/>
            <test name="org.apache.manifoldcf.crawler.tests.SanityHSQLDBextTest" todir="test-HSQLDBext-output"/>
            <!-- MHL -->
        </junit>
    </target>

    <target name="run-script-interpreter" depends="script-engine">
        <java classname="org.apache.manifoldcf.scriptengine.ScriptParser" fork="true" dir="dist/script-engine" maxmemory="128M">
          <classpath>
            <fileset dir="dist/script-engine/jar">
              <include name="*.jar"/>
            </fileset>
          </classpath>
        </java>
    </target>

    <target name="build" depends="multi-process-zk-example,multi-process-zk-example-proprietary,multi-process-file-example,multi-process-file-example-proprietary,single-process-example,single-process-example-proprietary,example-common,script-engine,obfuscation-utility,file-resources,buildfiles,test-lib"/>
    
    <target name="all" depends="build,doc,build-tests,run-tests,run-tests-HSQLDB,run-tests-HSQLDBext"/>
    
</project>
