blob: ad247cd0f41b2717b9d49c6dcaad1cd4f2e72915 [file] [log] [blame]
<!-- ============================================================ -->
<!-- Produce the webapp -->
<!-- ============================================================ -->
<!--
This target creates a webapp directory which exactly mirrors how
the war file will look. It is used to create the war file for
the "war" target but it can also be used by developers
directly.
This is useful if the reloadable attribute of the context
in the server.xml configuration is set to true so changes in the classes
are reflected immediately.
-->
<target name="webapp" depends="compile" description="Builds the webapp directory ready to be linked into a servlet engines context directory">
<!--
Copy CMS files and overwrite some parts of the previously unpacked cocoon webapp package with our customized files
-->
<echo>INFO: Copy files from ${src.webapp.dir} to ${build.webapp}</echo>
<copy todir="${build.webapp}">
<fileset dir="${src.webapp.dir}">
<exclude name="lenya/pubs/**"/>
<exclude name="WEB-INF/*-xconf.xsl"/>
</fileset>
</copy>
<!-- Copy publications -->
<echo>INFO: Copy publications from ${src.webapp.dir}/lenya/pubs to ${build.webapp}/lenya/pubs</echo>
<copyPubs todir="${build.webapp}/lenya/pubs" pubsrootdirs="${pubs.root.dirs}">
</copyPubs>
<!-- Patch cocoon.xconf -->
<echo>INFO: Patch cocoon.xconf</echo>
<xpatch file="${build.webapp}/WEB-INF/cocoon.xconf"
srcdir="${build.webapp}/lenya/pubs"
includes="*/config/cocoon.xconf"
addComments="true"/>
<!-- Patch publication tests -->
<echo>INFO: Patch publication tests</echo>
<copy file="./src/targets/publication-test-build-template.xml"
tofile="./src/targets/publication-test-build.xml"
overwrite="true"/>
<xpatch file="./src/targets/publication-test-build.xml"
srcdir="${build.webapp}/lenya/pubs"
includes="*/targets/test-build.xconf"
addComments="true"/>
<!-- create directory classes within webapp -->
<mkdir dir="${build.webapp}/WEB-INF/classes"/>
<!-- now copy our compiled classes -->
<echo>INFO: Copy classes from ${build.dest} to ${build.webapp}/WEB-INF/classes</echo>
<copy todir="${build.webapp}/WEB-INF/classes">
<fileset dir="${build.dest}">
<include name="**/*.class"/>
</fileset>
</copy>
<!-- now copy our logicsheets -->
<echo>INFO: Copy logicsheets from ${build.src} to ${build.webapp}/WEB-INF/classes</echo>
<copy todir="${build.webapp}/WEB-INF/classes">
<fileset dir="${build.src}">
<include name="**/*.xsl"/>
</fileset>
</copy>
<!-- now copy our properties -->
<echo>INFO: Copy properties from ${build.src} to ${build.webapp}/WEB-INF/classes</echo>
<copy todir="${build.webapp}/WEB-INF/classes">
<fileset dir="${build.src}">
<include name="**/*.properties"/>
</fileset>
</copy>
<!-- now copy our xml configuration files -->
<echo>INFO: Copy xml configuration files from ${build.src} to ${build.webapp}/WEB-INF/classes</echo>
<copy todir="${build.webapp}/WEB-INF/classes">
<fileset dir="${build.src}">
<include name="**/*.xml"/>
</fileset>
</copy>
<!-- now copy our roles -->
<echo>INFO: Copy properties from ${build.src} to ${build.webapp}/WEB-INF/classes</echo>
<copy todir="${build.webapp}/WEB-INF/classes">
<fileset dir="${build.src}">
<include name="**/*.roles"/>
</fileset>
</copy>
<!-- now create logs directory, where log4j can write to -->
<echo>INFO: Create logs directory ${build.webapp}/WEB-INF/logs</echo>
<mkdir dir="${build.webapp}/WEB-INF/logs"/>
<!-- now copy any additional libraries in ./lib -->
<mkdir dir="${build.webapp}/WEB-INF/lib"/>
<echo>INFO: Copy libraries from ${lib.dir} to ${build.webapp}/WEB-INF/lib</echo>
<echo>INFO: exclude: servlet.jar</echo>
<copy todir="${build.webapp}/WEB-INF/lib">
<fileset dir="${lib.dir}">
<include name="**/*"/>
<!-- servlet.jar is used to build Lenya, but for deployment the servlet.jar from the servlet engine will be taken -->
<exclude name="servlet.jar"/>
</fileset>
</copy>
<!-- now copy legal dir (licenses) -->
<echo>INFO: Copy Licenses</echo>
<mkdir dir="${build.webapp}/legal"/>
<copy todir="${build.webapp}/legal">
<fileset dir="legal"/>
</copy>
</target>
<!--
The war target just packs up what was created in the webapp target
(and triggers the javadoc target with the dependency)
-->
<target name="war" depends="webapp, javadocs" description="Builds the deployable war file">
<mkdir dir="${dist.bin.dir}"/>
<jar jarfile="${dist.bin.warfile}" basedir="${build.webapp}" excludes="META-INF/MANIFEST.MF"/>
</target>
<!-- ============================================================ -->
<!-- Clean targets -->
<!-- ============================================================ -->
<target name="reset" depends="clean" description="Resets the deployment by also cleaning the servlet engine context">
<!-- Empty server cache - this directory is set in the "build.properties" file -->
<delete dir="${tomcat.home.dir}/${tomcat.cache.dir}"/>
<mkdir dir="${tomcat.home.dir}/${tomcat.webapps.dir}" />
<delete includeEmptyDirs="true">
<fileset dir="${tomcat.home.dir}/${tomcat.webapps.dir}" excludes="${target.reset.excludes}" />
</delete>
</target>
<!-- ============================================================ -->
<!-- Install webapp -->
<!-- ============================================================ -->
<target name="install" depends="webapp" description="Install the webapp into servlet engine context">
<echo>INFO: Copy webapp to Tomcat</echo>
<echo>INFO: Copy From build.webapp=${build.webapp} To tomcat.webapps.dir=${tomcat.home.dir}/${tomcat.webapps.dir}</echo>
<copy todir="${tomcat.home.dir}/${tomcat.webapps.dir}" filtering="off">
<fileset dir="${build.webapp}" excludes="${target.install.excludes}"/>
</copy>
<echo>INFO: Copy endorsed libraries</echo>
<copy todir="${tomcat.home.dir}/${tomcat.endorsed.dir}">
<fileset dir="${build.webapp}/WEB-INF/lib/endorsed"/>
</copy>
<copy file="${build.webapp}/WEB-INF/lib/xercesImpl-2.5.0.jar" todir="${tomcat.home.dir}/${tomcat.endorsed.dir}"/>
<copy file="${build.webapp}/WEB-INF/lib/xml-apis.jar" todir="${tomcat.home.dir}/${tomcat.endorsed.dir}"/>
</target>
<!-- ============================================================ -->
<!-- Reload Tomcat -->
<!-- ============================================================ -->
<target name="reload">
<!-- For Tomcat Tasks -->
<path id="tomcat.classpath">
<fileset dir="${tomcat.home.dir}/${tomcat.webapps.dir}/../../server/lib"
includes="catalina-ant.jar" />
</path>
<taskdef name="reload"
classname="org.apache.catalina.ant.ReloadTask"
classpathref="tomcat.classpath" />
<reload
url="http://localhost:8080/manager"
username="nobby"
password="f800sl"
path="/lenya"/>
</target>