<?xml version="1.0" encoding="UTF-8"?> <project name="minerva" default="main" basedir="."> <property environment="env"/> <property name="build.dir" value="web/target"/> <property name="war.file" value="web-1.0.war"/> <property name="tomcat.home" value="${env.CATALINA_HOME}"/> <property name="tomcat.deploy.dir" value="${tomcat.home}/webapps"/> <condition property="isWindows"> <os family="windows"/> </condition> <condition property="isUnix"> <os family="unix"/> </condition> <target name="war-exists"> <available file="${tomcat.deploy.dir}/${ant.project.name}.war" property="war.exists"/> </target> <target name="remove-war" depends="war-exists" if="war.exists"> <delete file="${tomcat.deploy.dir}/${ant.project.name}.war"/> </target> <target name="war-dir-exists"> <available file="${tomcat.deploy.dir}/${ant.project.name}" property="war-dir.exists" type="dir"/> </target> <target name="remove-war-dir" depends="war-dir-exists" if="war-dir.exists"> <delete dir="${tomcat.deploy.dir}/${ant.project.name}"/> </target> <target name="deploy" depends="remove-war,remove-war-dir"> <copy file="${build.dir}/${war.file}" todir="${tomcat.deploy.dir}"/> <move file="${tomcat.deploy.dir}/${war.file}" tofile="${tomcat.deploy.dir}/${ant.project.name}.war"/> </target> <target name="main" depends="tomcat-stop,maven-build,deploy,tomcat-start"> </target> <target name="all" depends="main"> </target> <target name="tomcat-start" depends="tomcat-start-windows, tomcat-start-unix"/> <target name="tomcat-start-windows" if="isWindows"> <exec executable="${tomcat.home}/bin/startup.bat"/> </target> <target name="tomcat-start-unix" if="isUnix"> <exec executable="${tomcat.home}/bin/startup.sh"/> </target> <target name="tomcat-stop" depends="tomcat-stop-windows, tomcat-stop-unix"/> <target name="tomcat-stop-windows" if="isWindows"> <exec executable="${tomcat.home}/bin/shutdown.bat"/> </target> <target name="tomcat-stop-unix" if="isUnix"> <exec executable="${tomcat.home}/bin/shutdown.sh"/> </target> <target name="maven-build" depends="gitversion, maven-build-windows, maven-build-unix"/> <target name="maven-build-windows" if="isWindows"> <exec dir="." executable="cmd"> <arg line="/c mvn -Dmaven.test.skip=true clean install -pl web -am"/> </exec> </target> <target name="maven-build-unix" if="isUnix"> <exec dir="." executable="sh"> <arg line="-c 'mvn -Dmaven.test.skip=true clean install -pl web -am'"/> </exec> </target> <target name="maven-test" depends="maven-test-windows, maven-test-unix"/> <target name="maven-test-windows" depends="maven-build" if="isWindows"> <exec dir="." executable="cmd"> <arg line="/c mvn test -fn"/> <!-- <arg line="/c mvn surefire-report:report" /> --> </exec> </target> <target name="maven-test-unix" depends="maven-build" if="isUnix"> <exec dir="." executable="sh"> <arg line="-c 'mvn test -fn'"/> <!-- <arg line="-c 'mvn surefire-report:report'" /> --> </exec> </target> <target name="deployMapFiles"> <copy todir="${tomcat.deploy.dir}/map_images"> <fileset dir="map_images"/> </copy> </target> <target name="gitversion"> <exec executable="git" outputproperty="gitversion"> <arg value="rev-parse"/> <arg value="HEAD"/> </exec> <tstamp> <format property="build.time" pattern="dd/MM/yyyy HH:mm" unit="hour"/> </tstamp> <echo>GIT Version: ${gitversion} Build timestamp: ${build.time} </echo> <echo file="web/src/main/webapp/version.txt">${gitversion} ${build.time} </echo> <copy file="CHANGELOG" tofile="web/src/main/webapp/CHANGELOG" overwrite="true"/> </target> <target name="debian-pkg" depends="maven-build"> <exec executable="debian/create-debian-pkg.sh"/> </target> </project>