Show build.xml syntax highlighted
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="all.appserver" name="negest">
<!-- =========================================================================================================== -->
<!-- P R O P E R T Y D E F I N I T I O N S -->
<!-- =========================================================================================================== -->
<!-- Global settings -->
<property file="../.ant-global.properties"/>
<property environment="env"/>
<!-- Directory-specifications -->
<property name="project.name" value="negest" />
<property name="src.service.dir" value="./src/java-service/"/>
<property name="src.ejb.dir" value="./src/java-ejb/"/>
<property name="src.web.dir" value="./webapp/WEB-INF/src/"/>
<property name="src.test.dir" value="./src/java-test/"/>
<property name="web.dir" value="./webapp/"/>
<property name="lib.dir" value="lib"/>
<property name="build.dir" value="build"/>
<property name="build.service.dir" value="${build.dir}/build-service"/>
<property name="build.ejb.dir" value="${build.dir}/build-ejb"/>
<property name="build.web.dir" value="${build.dir}/build-web"/>
<property name="build.test.dir" value="${build.dir}/build-test"/>
<property name="build.todo.dir" value="${build.dir}/build-todo"/>
<property name="build.junit.dir" value="${build.dir}/build-junit"/>
<property name="build.coverage.dir" value="${build.dir}/build-coverage"/>
<property name="build.instrumented.dir" value="${build.dir}/instrumented"/>
<property name="build.checkstyle.dir" value="${build.dir}/build-checkstyle"/>
<property name="dist.dir" value="dist"/>
<property name="conf.dir" value="./conf/"/>
<property name="temp.dir" value="temp"/>
<property name="metainf.dir" value="${conf.dir}/META-INF"/>
<property name="webinf.dir" value="${conf.dir}/WEB-INF"/>
<property name="javadoc.dir" value="doc/api"/>
<!-- Additional variables -->
<property name="jar.ejb.name" value="ejb.ejb3"/>
<property name="jar.test.name" value="test.jar"/>
<property name="jar.generated.name" value="${dist.dir}/${project.name}-${jar.ejb.name}"/>
<property name="ear.name" value="${project.name}.ear"/>
<property name="war.name" value="${dist.dir}/${project.name}.war"/>
<property name="compile.debug" value="true"/>
<property name="MailLogger.failure.to" value="negest@finalist.com" />
<!-- Specify the default webserver port -->
<property name="webserver.port" value="8080" />
<!-- JUnit output directory definitions -->
<property name="build.reports.base.dir" value="${build.junit.dir}"/>
<property name="build.reports.xml.dir" value="${build.reports.base.dir}/xml"/>
<property name="build.reports.html.dir" value="${build.reports.base.dir}/html"/>
<property name="coverage.html.dir" value="${build.coverage.dir}/html"/>
<!-- =========================================================================================================== -->
<!-- P A T H D E F E N I T I O N S -->
<!-- =========================================================================================================== -->
<path id="base.classpath">
<fileset dir="${lib.dir}">
<include name="*.jar"/>
<include name="*.zip"/>
</fileset>
<pathelement path="${build.service.dir}"/>
<pathelement path="${build.ejb.dir}"/>
<fileset dir="${appserver.home.dir}/lib">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${appserver.home.dir}/server/all/lib">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${appserver.home.dir}/server/all/deploy/ejb3.deployer">
<include name="*.jar"/>
</fileset>
<fileset dir="${appserver.home.dir}/server/all/deploy/">
<include name="*.jar"/>
</fileset>
</path>
<path id="coverage.classpath">
<pathelement location="${build.service.dir}"/>
</path>
<path id="jboss.classpath">
<!-- JBoss classes needed for testing Session EJBs from a JUnit client -->
<!-- JBoss3: -->
<fileset dir="${appserver.deploy.dir}/../../../client">
<include name="*.jar"/>
</fileset>
</path>
<!-- =========================================================================================================== -->
<!-- C H E C K -->
<!-- =========================================================================================================== -->
<!-- Checks wether the library for the lib anttasks exists or not. If not it will be checked out -->
<target name="init.ant">
<mkdir dir="${lib.dir}"/>
<available property="finalist-ant.present" file="${lib.dir}/finalist-ant-1.3.jar"/>
<available property="lib-dtd.present" file="${conf.dir}/lib.dtd"/>
<antcall target="checkout.finalist.ant"/>
</target>
<!-- Checks whether the '.ant-global.properties' file is available in the base directory -->
<!-- of your project. If not available warning messages will be written to the console. -->
<target name="check.ant-global" description="fails if we cannot find .ant-global.properties">
<available file="../.ant-global.properties" property="global.properties.present"/>
</target>
<target name="check.ant-global.present" depends="check.ant-global" unless="global.properties.present">
<echo>
============================ MISSING PROPERTY FILE ============================
It is recommended that you create a properties file named '.ant-global.properties' in the
directory 'above' (./..) where this build.xml file is.
This file needs to contain the following properties, adapted for your machine:
appserver.deploy.dir - the directory where the application 'ear' file will be deployed
appserver.home.dir - the root directory of the application server.
proxy.host - the IP address of your HTTP proxy (leave this property out if there is no proxy)
proxy.port - the access port number of your HTTP proxy (leave this property out if there is no proxy)
e.g.
appserver.deploy.dir =C:/jboss-3.2.3/server/default/deploy
appserver.home.dir =C:/jboss-3.2.3
proxy.host =192.168.1.10
proxy.port =3128
===============================================================================
</echo>
</target>
<target name="checkout.finalist.ant" depends="check.libs, get.libs"/>
<target name="check.libs">
<available file="${lib.dir}/finalist-ant-1.3.jar" property="finalist-ant.present"/>
<available file="${conf.dir}/lib.dtd" property="lib-dtd.present"/>
<condition property="nothing.to.download">
<and>
<isset property="finalist-ant.present"/>
<isset property="lib-dtd.present"/>
</and>
</condition>
</target>
<target name="get.libs">
<condition property="proxy.needs.setting">
<and>
<not>
<isfalse value="nothing.to.download"/>
</not>
<not>
<equals arg1="" arg2="${proxy.host}" trim="true"/>
</not>
</and>
</condition>
<antcall target="set.proxy"/>
<antcall target="get.finalist-ant"/>
<antcall target="get.lib-dtd"/>
</target>
<target name="set.proxy" depends="check.proxy.host, check.proxy.port" if="proxy.needs.setting">
<echo message="Using HTTP proxy at ${proxy.host}:${proxy.port}..."/>
<setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}"/>
</target>
<target name="get.finalist-ant" unless="finalist-ant.present">
<get src="http://jag.sourceforge.net/download/jag/jars/finalist-ant-1.3.jar" dest="${lib.dir}/finalist-ant-1.3.jar"/>
</target>
<target name="get.lib-dtd" unless="lib-dtd.present">
<get src="http://jag.sourceforge.net/download/lib.dtd" dest="${conf.dir}/lib.dtd"/>
</target>
<!-- Checks whether the 'appserver.deploy.dir' property is defined in the '.ant-global.properties' -->
<!-- file. If not defined warning messages are written to the console. -->
<target name="check.appserver.deploy.dir" unless="appserver.deploy.dir">
<echo message="Application server deploy directory does not exist!"/>
<fail message="Please add appserver.deploy.dir to '../.ant-global.properties'"/>
</target>
<target name="check.appserver.home.dir" unless="appserver.home.dir">
<echo message="Application server home directory does not exist!"/>
<fail message="Please add appserver.home.dir to '../.ant-global.properties'"/>
</target>
<!-- Checks whether the proxy setting are defined in the '.ant-global.properties' -->
<!-- file. If not defined warning messages are written to the console. -->
<target name="check.proxy.host" unless="proxy.host">
<echo message="Proxy host is not set!"/>
<echo message="Please add proxy.host to '../.ant-global.properties' in case you're using a proxy server for internet access."/>
</target>
<target name="check.proxy.port" unless="proxy.port">
<echo message="Proxy port is not set!"/>
<echo message="Please add proxy.port to '../.ant-global.properties' in case you're using a proxy server for internet access."/>
</target>
<!-- =========================================================================================================== -->
<!-- T A R G E T D E F I N I T I O N S -->
<!-- =========================================================================================================== -->
<!-- Creates a basic set of directories. -->
<target name="init" depends="check.ant-global.present, check.appserver.home.dir, checkout.lib">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.service.dir}"/>
<mkdir dir="${build.ejb.dir}"/>
<mkdir dir="${build.ejb.dir}/META-INF"/>
<mkdir dir="${build.web.dir}"/>
<mkdir dir="${build.test.dir}"/>
<mkdir dir="${build.checkstyle.dir}"/>
<mkdir dir="${dist.dir}"/>
</target>
<!-- Compiles all sources that reside in the 'src.service.dir' -->
<!-- directory to the 'build.service.dir' directory. -->
<target name="build.service" description="Build the service layer with the business interfaces" depends="init">
<javac debug="${compile.debug}" deprecation="true" destdir="${build.service.dir}">
<classpath>
<path refid="base.classpath"/>
</classpath>
<src path="${src.service.dir}"/>
</javac>
<copy todir="${build.service.dir}">
<fileset dir="${src.service.dir}" includes="**/*.properties" />
</copy>
</target>
<!-- Build the jar file with the service layer into 'dist.dir' -->
<target name="jar.service" description="Build the jar file for the service layer" depends="build.service">
<jar destfile="${dist.dir}/negest-service.jar" basedir="${build.service.dir}"/>
</target>
<!-- Compiles all sources that reside in the 'src.ejb.dir' and the 'src.generated' -->
<!-- directory to the 'build.ejb.dir' directory. -->
<target name="build.ejb" description="Compile everything in the EJB layer" depends="build.service">
<javac debug="${compile.debug}" deprecation="true" destdir="${build.ejb.dir}">
<classpath>
<path refid="base.classpath"/>
</classpath>
<src path="${src.ejb.dir}"/>
</javac>
</target>
<!-- Compiles all sources that reside in the 'src.web.dir' to the 'build.web.dir' directory. -->
<target name="build.web" description="Compile everything in the web-layer (src/java-web)" depends="build.service">
<javac debug="${compile.debug}" deprecation="true" destdir="${build.web.dir}" srcdir="${src.web.dir}">
<classpath>
<path refid="base.classpath"/>
</classpath>
</javac>
</target>
<!-- Compiles all sources that reside in the 'src.test.dir' to the 'build.test.dir' directory. -->
<target name="build.test" description="Compile test classes" depends="build.service,build.web, build.ejb ">
<javac debug="${compile.debug}" deprecation="true" destdir="${build.test.dir}" srcdir="${src.test.dir}">
<classpath>
<path refid="base.classpath"/>
<path path="${build.ejb.dir}"/>
</classpath>
</javac>
</target>
<!-- Jars all Junit test files from the 'build.test.dir'. -->
<target name="jar.test" description="jars source files for JUnit test" depends="build.test">
<jar basedir="${build.test.dir}" jarfile="${jar.test.name}"/>
</target>
<!-- Display some messages for the autobuild log file. Writes messages to the console. -->
<target name="messages.autobuild"
description="Show some messages that will be shown at the start of the autobuild log file.">
<!-- Used to display some messages.. -->
<echo message="The results of the autobuild:"/>
</target>
<!-- Initialize for the autobuild. Not needed here. -->
<target name="init.autobuild"
description="Will be called by the autobuild before calling run.autobuild. Initialization can be done here.">
<!-- No initialization needed -->
</target>
<!-- Runs all targets needed to perform an autobuild. -->
<target name="run.autobuild" depends="messages.autobuild,all.appserver,deploy,javadoc,todo,auto.checkstyle,test"
description="Runs the autobuild. Add in the depend list all steps that should be taken by the autobuild." />
<!-- Finishes the autbobuild. Writes messages to the console. -->
<target name="finish.autobuild" description="Will be called by the autobuild after the run.autobuild has been completed. Here all targets should be called to complete the autobuild like mailing/copying results, clean up deploy directories etc..">
<antcall target="copy.autobuild.results"/>
<antcall target="undeploy.ear.appserver"/>
<echo message="" />
<echo message="The autobuild has finished."/>
</target>
<!-- Copies the results of the autobuild to the webserver environment. -->
<target name="copy.autobuild.results">
<mkdir dir="${apache.dir}/${project.name}"/>
<mkdir dir="${apache.dir}/${project.name}/javadoc"/>
<mkdir dir="${apache.dir}/${project.name}/junit"/>
<mkdir dir="${apache.dir}/${project.name}/buildlog"/>
<mkdir dir="${apache.dir}/${project.name}/todo"/>
<copy file="build.log" tofile="${apache.dir}/${project.name}/buildlog/build.txt"/>
<copy todir="${apache.dir}/${project.name}/javadoc">
<fileset dir="${javadoc.dir}"/>
</copy>
<copy todir="${apache.dir}/${project.name}/todo">
<fileset dir="${build.todo.dir}"/>
</copy>
<copy todir="${apache.dir}/${project.name}/junit">
<fileset dir="${build.reports.html.dir}"/>
</copy>
</target>
<!-- Create javadoc from the sources in the 'src.web.dir', 'src.generated' and 'src.ejb.dir' directories. -->
<target name="javadoc" description="Generates javadoc.">
<mkdir dir="${javadoc.dir}"/>
<javadoc destdir="${javadoc.dir}" packagenames="com.*" >
<classpath>
<pathelement path="${build.service.dir}"/>
<pathelement path="${build.ejb.dir}"/>
<pathelement path="${build.web.dir}"/>
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
</classpath>
<sourcepath>
<pathelement path="${src.service.dir}"/>
<pathelement path="${src.web.dir}"/>
<pathelement path="${src.ejb.dir}"/>
</sourcepath>
<group title="Finalist" packages="com.*"/>
<link offline="true" href="http://java.sun.com/j2se/1.3/docs/api/"
packagelistLoc="doc/javadoc_packages/jdk13_packagelist"/>
<link offline="true" href="http://java.sun.com/j2ee/sdk_1.2.1/techdocs/api/"
packagelistLoc="doc/javadoc_packages/j2ee_packagelist"/>
<tag name="struts.form" scope="all" description=" "/>
<tag name="struts.action" scope="all" description=" "/>
<tag name="struts.action-forward" scope="all" description=" "/>
<tag name="ejb.bean" scope="all" description=" "/>
<tag name="ejb.pk" scope="all" description=" "/>
<tag name="ejb.finder" scope="all" description=" "/>
<tag name="ejb.transaction" scope="all" description=" "/>
<tag name="ejb.util" scope="all" description=" "/>
<tag name="ejb.persistence" scope="all" description=" "/>
<tag name="ejb.create-method" scope="all" description=" "/>
<tag name="ejb.relation" scope="all" description=" "/>
<tag name="ejb.value-object" scope="all" description=" "/>
<tag name="jboss.relation" scope="all" description=" "/>
<tag name="jboss.persistence" scope="all" description=" "/>
<tag name="weblogic.column-map" scope="all" description=" "/>
<tag name="jag.relation" scope="all" description=" "/>
</javadoc>
</target>
<!-- Generate todo-list from @todo tags. -->
<target name="todo" depends="init">
<delete dir="${build.todo.dir}"/>
<taskdef classname="xdoclet.modules.doc.DocumentDocletTask" classpathref="base.classpath" name="document"/>
<document destdir="${build.todo.dir}" >
<fileset dir="${src.ejb.dir}">
<include name="**/*.java"/>
</fileset>
<fileset dir="${src.web.dir}">
<include name="**/*.java"/>
</fileset>
<fileset dir="${src.test.dir}">
<include name="**/*.java"/>
</fileset>
<info header="Todo list" projectname="${ant.project.name}" tag="todo"/>
</document>
</target>
<!-- test target is called in the autobuild -->
<target name="test" depends="junit.report,coverage.report">
</target>
<!-- Runs JUnit tests. -->
<target name="junit" description="Runs All JUnit tests" depends="jar.test,_coverage ,check.appserver.deploy.dir">
<!-- Testing if a custom JNDI port is specified in -->
<!-- .ant-global-properties -->
<condition property="actual.jndi.port" value="${appserver.jndi.port}">
<isset property="appserver.jndi.port"/>
</condition>
<condition property="actual.jndi.port" value="1099">
<not>
<isset property="appserver.jndi.port"/>
</not>
</condition>
<echo message="Make sure the junit.jar and optional.jar file are in your ant\lib directory"/>
<delete dir="${build.reports.xml.dir}"/>
<mkdir dir="${build.reports.xml.dir}"/>
<echo message="Running unit tests... (Using jndi port: ${actual.jndi.port})"/>
<junit fork="yes" haltonfailure="no" showOutput="yes" printSummary="on">
<jvmarg value="-Demma.coverage.out.file=${build.instrumented.dir}/coverage.emma" />
<jvmarg value="-Demma.coverage.out.merge=true" />
<jvmarg value="-Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory"/>
<jvmarg value="-Djava.naming.provider.url=localhost:${actual.jndi.port}"/>
<jvmarg value="-Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces"/>
<classpath>
<pathelement location="${build.instrumented.dir}"/>
<path refid="jboss.classpath"/>
<path refid="base.classpath"/>
<pathelement path="${jar.test.name}"/>
<pathelement path="${conf.dir}"/>
<pathelement path="${build.test.dir}"/>
<pathelement path="${build.service.dir}"/>
<pathelement path="${build.ejb.dir}"/>
<pathelement path="${build.web.dir}"/>
<fileset dir="." includes="${jar.test.name}"/>
</classpath>
<batchtest todir="${build.reports.xml.dir}">
<fileset dir="${build.test.dir}">
<include name="**/*TestCase.class"/>
<include name="**/*Test.class"/>
</fileset>
<formatter type="xml"/>
</batchtest>
</junit>
<delete>
<fileset dir="${build.test.dir}" includes="**/*Test.class"/>
<fileset dir="${build.test.dir}" includes="**/*TestCase.class"/>
</delete>
<delete file="${jar.test.name}"/>
</target>
<!-- Generates test reports. -->
<target name="junit.report" description="Generates JUnit test reports" depends="junit">
<taskdef classpathref="base.classpath" name="junitreport"
classname="org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator"/>
<mkdir dir="${build.reports.html.dir}"/>
<junitreport todir="${build.reports.html.dir}">
<fileset dir="${build.reports.xml.dir}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${build.reports.html.dir}"/>
</junitreport>
</target>
<target name="coverage.report">
<taskdef resource="emma_ant.properties" classpathref="base.classpath" />
<!-- if enabled, generate coverage report(s): -->
<emma enabled="true" >
<report
sort="+block,+name,+method,+class"
metrics="method:70,block:80,line:80,class:100"
>
<sourcepath>
<pathelement location="${src.service.dir}"/>
</sourcepath>
<fileset dir="." >
<include name="${build.instrumented.dir}/*.emma" />
</fileset>
<html outfile="${coverage.html.dir}/index.html"
depth="method"
columns="name,class,method,block,line"
/>
</report>
</emma>
</target>
<target name="_coverage">
<taskdef resource="emma_ant.properties" classpathref="base.classpath" />
<mkdir dir="${build.instrumented.dir}"/>
<emma enabled="true" >
<instr instrpathref="coverage.classpath"
destdir="${build.instrumented.dir}"
metadatafile="${build.instrumented.dir}/metadata.emma"
merge="false"
>
</instr>
</emma>
</target>
<!-- performs an ejb build and creates the ejb jar file. -->
<target name="ejb.appserver" depends="jar.service, build.ejb,jar.ejb"
description="Runs ejbdoclet and builds jar for the appserver">
<move file="${jar.ejb.name}" tofile="${jar.generated.name}"/>
</target>
<!-- Performs a build and creates the JBoss ejb.jar file. -->
<target name="jar.appserver" description="Creates the generic EJB-Jar." depends="build.ejb,jar.ejb">
</target>
<!-- Performs a build and creates the JBoss ejb.jar file but first deletes currently existing ejb.jar files. -->
<target name="jar.ejb" description="Creates the generic EJB-Jar." depends="delete.jar">
<jar jarfile="${jar.ejb.name}">
<manifest>
<attribute name="Built-By" value="JAG"/>
<attribute name="Class-Path"
value="negest-service.jar commons-beanutils-1.7.0.jar commons-collections-3.1.jar commons-digester-1.7.jar commons-lang-2.1.jar commons-validator-1.1.3.jar statementexecutor-1.1.jar generic-exceptions-1.0.jar "/>
</manifest>
<fileset dir="${conf.dir}">
<include name="log4jfinalist-${project.name}.xml"/>
<include name="META-INF/jboss.xml"/>
</fileset>
<fileset dir="${build.ejb.dir}"/>
</jar>
</target>
<!-- Creates the war file but first build the web layer, delete existing wars and run webdoclet. -->
<target name="war" description="Creates the WAR-file." depends="build.web,delete.war,webdoclet">
<antcall target="build.war"/>
</target>
<target name="build.war">
<taskdef name="warAutoLib" classpathref="base.classpath"
classname="com.finalist.tools.ant.taskdefs.WarAutoLib"/>
<warAutoLib warfile="${war.name}" webxml="${webinf.dir}/web.xml" libXmlFile="${conf.dir}/lib.xml"
libDir="${lib.dir}">
<webinf dir="${webinf.dir}">
<include name="struts-config.xml"/>
<include name="validat*.xml"/>
</webinf>
<fileset dir="${conf.dir}" includes="**/*.tld"/>
<webinf dir="${conf.dir}" prefix="WEB-INF/classes">
<include name="log4jfinalist-${project.name}.xml"/>
<include name="**/*.properties"/>
</webinf>
<classes dir="${build.web.dir}"/>
<fileset dir="${web.dir}" excludes="**/WEB-INF/**/*.nbattrs"/>
</warAutoLib>
</target>
<!-- Deletes the war file. -->
<target name="delete.war">
<delete file="${war.name}"/>
</target>
<!-- Deletes both the ejb.jar and the project specific ejb.jar. -->
<target name="delete.jar">
<delete file="${jar.generated.name}"/>
<delete file="${jar.ejb.name}"/>
</target>
<!-- Removes all directories and files created by the build.xml file except for the lib directory. -->
<target name="clean" description="Cleans the project (removes DIST and BUILD-directories).">
<delete dir="${build.dir}"/>
<delete dir="${build.ejb.dir}"/>
<delete dir="${build.web.dir}" failonerror="false" />
<delete dir="${build.test.dir}" failonerror="false" />
<delete dir="${build.todo.dir}" failonerror="false" />
<delete dir="${build.junit.dir}" failonerror="false" />
<delete dir="${coverage.html.dir}" failonerror="false" />
<delete dir="${build.checkstyle.dir}" failonerror="false" />
<delete dir="${dist.dir}"/>
<delete>
<fileset defaultexcludes="false" dir=".">
<patternset>
<include name="**/*.class"/>
<include name="**/*~"/>
</patternset>
</fileset>
</delete>
</target>
<!-- Creates everything needed by the application server. -->
<target name="all.appserver" description="Creates the EAR-file for jboss." depends="jar.service,ejb.appserver, war,ear.appserver">
</target>
<!-- Creates a appserver specific ear file. -->
<target name="ear.appserver" depends="check.proxy.host, check.proxy.port"
description="Creates the EAR-file.">
<delete file="${ear.name}"/>
<taskdef name="earAutoLib" classpathref="base.classpath"
classname="com.finalist.tools.ant.taskdefs.EarAutoLib"/>
<earAutoLib libXmlFile="${conf.dir}/lib.xml" libDir="${lib.dir}" appxml="${metainf.dir}/application.xml"
basedir="${dist.dir}" earfile="${ear.name}" proxyHost="${proxy.host}" proxyPort="${proxy.port}">
<fileset dir="${conf.dir}" includes="META-INF/hibernate.properties"/>
</earAutoLib>
</target>
<target name="deploy" description="Deploys the generated application" depends="deploy.ear.appserver">
</target>
<!-- Copies the ear file and datasource definition to the JBoss deployment environment. -->
<target name="deploy.ear.appserver" description="Deploys the JBoss EAR" depends="check.appserver.deploy.dir">
<!-- Make sure the JDBC Driver for the datasource is available! -->
<copy file="lib/../lib/mysql-connector-java-3.1.12-bin.jar" todir="${appserver.deploy.dir}"/>
<copy file="${conf.dir}/negest-mysql-ds.xml" todir="${appserver.deploy.dir}"/>
<!-- Deploy the sequence generator if you need autogenerated primary keys for Entity EJBs -->
<copy file="${lib.dir}/sequencegenerator-ejb-1.0.jar" todir="${appserver.deploy.dir}" />
<!-- And finally deploy the ear. -->
<copy file="${ear.name}" todir="${appserver.deploy.dir}"/>
</target>
<target name="deploy.war.appserver" description="Deploys the JBoss WAR" depends="check.appserver.deploy.dir">
<!-- Make sure the JDBC Driver for the datasource is available! -->
<copy file="lib/../lib/mysql-connector-java-3.1.12-bin.jar" todir="${appserver.deploy.dir}"/>
<copy file="${conf.dir}/negest-mysql-ds.xml" todir="${appserver.deploy.dir}"/>
<!-- Deploy the sequence generator if you need autogenerated primary keys for Entity EJBs -->
<copy file="${lib.dir}/sequencegenerator-ejb-1.0.jar" todir="${appserver.deploy.dir}" />
<copy file="${war.name}" todir="${appserver.deploy.dir}"/>
<!-- And finally deploy the war. -->
</target>
<!-- Removes the ear file and datasource definition from the deployment environment. -->
<target name="undeploy.ear.appserver" description="Undeploys the JBoss EAR" depends="check.appserver.deploy.dir">
<delete file="${appserver.deploy.dir}/${ear.name}"/>
<delete file="${appserver.deploy.dir}/sequencegenerator-ejb.jar"/>
<delete file="${appserver.deploy.dir}/negest-mysql-ds.xml"/>
</target>
<!-- Removes the lib directory. -->
<target name="delete.lib">
<delete dir="${lib.dir}"/>
</target>
<!-- Creates the lib directory and checks out all jars needed by the project. -->
<target name="checkout.lib" description="CVS-checkout for needed JARs." depends="init.ant">
<taskdef name="checkout" classpathref="base.classpath"
classname="com.finalist.tools.ant.taskdefs.CheckoutLibTask"/>
<checkout libXmlFile="${conf.dir}/lib.xml" libDir="${lib.dir}" tmpDir="${temp.dir}" />
</target>
<!-- Generates the 'struts-config.xml' file using webdoclet. Analyses all source files in the web directory -->
<!-- for the availability of specific webdoclet tags and creates the config file. -->
<target name="webdoclet" description="Re-Generate struts-config.xml using XDoclet" depends="init">
<taskdef name="docletfix" classname="com.finalist.tools.ant.taskdefs.DocletFixTask" classpathref="base.classpath" />
<delete dir="${temp.dir}" />
<docletfix tempdir="${temp.dir}">
<fileset dir="${src.web.dir}">
<include name="**/*Action.java"/>
<include name="**/*Form.java"/>
</fileset>
</docletfix>
<taskdef classname="xdoclet.modules.web.WebDocletTask" classpathref="base.classpath" name="webdoclet"/>
<delete file="${webinf.dir}/struts-config.xml"/>
<webdoclet destdir="${webinf.dir}">
<fileset dir="${temp.dir}">
<include name="**/*Action.java"/>
<include name="**/*Form.java"/>
</fileset>
<strutsconfigxml mergedir="${webinf.dir}" version="1.2" validateXML="true"/>
</webdoclet>
<delete dir="${temp.dir}" />
</target>
<!-- run this target as part of automated build -->
<target name="auto.checkstyle" depends="checkstyle" if="checkstyle.failure" description="Sends email if checkstyle detected code conventions violations.">
<mail from="autobuild@mydomain.com"
tolist="${MailLogger.failure.to}"
mailhost="localhost"
subject="Coding style violation(s) in project ${project.name}"
message="Finalist Coding Style violations found by Checkstyle!"
files="${build.checkstyle.dir}/checkstyle-noframes.html"
encoding="plain"
messagemimetype="text/html"/>
</target>
<!-- Automatically checks the style of the sources in the 'src.ejb.dir' and the 'src.web.dir'. -->
<!-- Output is written to a set of html files. -->
<target name="checkstyle" description="Generates a report of Finalist code style convention violations.">
<taskdef resource="checkstyletask.properties" classpathref="base.classpath"/>
<mkdir dir="${build.checkstyle.dir}"/>
<checkstyle config="${lib.dir}/finalist_checks.xml"
failureProperty="checkstyle.failure"
failOnViolation="false">
<formatter type="xml" tofile="${build.checkstyle.dir}/checkstyle_report.xml"/>
<fileset dir="${src.ejb.dir}" includes="**/*.java"/>
<fileset dir="${src.web.dir}" includes="**/*.java"/>
</checkstyle>
<style in="${build.checkstyle.dir}/checkstyle_report.xml"
out="${build.checkstyle.dir}/checkstyle-noframes.html"
style="${lib.dir}/checkstyle-noframes.xsl"/>
</target>
<!-- ===================================================================== -->
<!--Jmeter targets -->
<!-- ===================================================================== -->
<target name="auto.jmeter" depends="run.jmeter" description="Sends email with Jmeter results.">
<mail from="jmeter@mydomain.com"
tolist="${MailLogger.failure.to}"
mailhost="smarthost.kennisnet.nl" encoding="plain" messagemimetype="text/html"
subject="Jmeter results in project ${project.name}"
message="Kennisnet Jmeter Results"
files="${build.dir}/jmeter/spider.html"
/>
</target>
<target name="prepare.jmeter">
<taskdef name="jmeter" classname="org.programmerplanet.ant.taskdefs.jmeter.JMeterTask" classpathref="base.classpath"/>
<delete file="${build.dir}/jmeter/spider.jtl"/>
</target>
<!--
To run the jmeter ant task, make sure the jmeter.home property has been
set in the .ant-global.properties file.
-->
<target name="run.jmeter" depends="prepare.jmeter" description="Runs the jmeter task.">
<delete file="${build.dir}/generated/jmeter/spider.jtl"/>
<copy file="${conf.dir}/jmeter/collapse.jpg" todir="${build.dir}/jmeter"/>
<copy file="${conf.dir}/jmeter/expand.jpg" todir="${build.dir}/jmeter"/>
<taskdef
name="jmeter"
classname="org.programmerplanet.ant.taskdefs.jmeter.JMeterTask"
classpathref="base.classpath"
/>
<jmeter jmeterhome="${jmeter.home}"
testplan="${conf.dir}/jmeter/${project.name}.jmx"
resultlog="${build.dir}/jmeter/spider.jtl">
<jvmarg value="-Xmx128m"/>
</jmeter>
<xslt in="${build.dir}/jmeter/spider.jtl"
out="${build.dir}/jmeter/spider.html"
style="${conf.dir}/jmeter/jmeter-results-detail-report.xsl"/>
</target>
<!--
Start the hsql db admin tool
-->
<target name="db.gui" description="Start the hsqldb admin tool">
<property name="database.urlparams" value="?user=root&password=mkl*99"/>
<java
classname="org.hsqldb.util.DatabaseManager"
fork="yes"
classpathref="base.classpath"
failonerror="true"
>
<arg value="-url"/>
<arg value="jdbc:mysql://localhost:3306/negest"/>
<arg value="-driver"/>
<arg value="com.mysql.jdbc.Driver"/>
</java>
</target>
</project>
See more files for this project here