Example - build.xml

<?xml version="1.0" encoding="utf-8"?>
<project name="Example Project" default="help" basedir=".">

<!-- ===================================================================== -->

	<!-- HELP -->
   <target name="help" description="Display help on targets">
      <exec dir="${basedir}" executable="ant.bat" osfamily="windows">
         <arg value="-projecthelp"/>
      </exec>
      <exec dir="${basedir}" executable="ant" osfamily="unix">
         <arg value="-projecthelp"/>
      </exec>	  
   </target>

<!-- ===================================================================== -->

   <!-- Read User Properties from property File -->
   <property file="build.properties"/>
   <fail message="Please adjust the file build.properties first! (oracle.home)"        unless="oracle.home" />
   <fail message="Please adjust the file build.properties first! (oracle.instance)"    unless="oracle.instance" />
   <fail message="Please adjust the file build.properties first! (forms.compiler)"     unless="forms.compiler" />  
   <fail message="Please adjust the file build.properties first! (reports.compiler)"   unless="reports.compiler" />
   <fail message="Please adjust the file build.properties first! (default.forms_path)" unless="default.forms_path" />
   <fail message="Please adjust the file build.properties first! (nls.lang)"           unless="nls.lang" />
   <fail message="Please adjust the file build.properties first! (db.userid)"          unless="db.userid" />
   
   <!-- Read Project Properties from property File (should be checked in) -->
   <property file="project.properties"/>
   <fail message="Please adjust the file project.properties first! (app.name)"          unless="app.name" />
   <fail message="Please adjust the file project.properties first! (app.vendor)"        unless="app.vendor" />
   <fail message="Please adjust the file project.properties first! (icons.jar)"         unless="icons.jar" />
   
   <fail message="Please adjust the file build.properties or project.properties first! (lib.oformsci)"       unless="lib.oformsci" />

<!-- ===================================================================== -->

   <!-- include the OFormsCI tasks -->
   <taskdef resource="de/cenote/oformsci/anttask/definition.properties" >
      <classpath>
		<pathelement location="${lib.oformsci}" />
	  </classpath>
   </taskdef>
   
<!-- ===================================================================== -->

   <!--  default values -->
   <property name="forms.src"      location="${basedir}/src/main/oforms" />
   <property name="reports.src"    location="${forms.src}" />
   <property name="icons.src"      location="${basedir}/src/main/icons" />
   <property name="build.base"     location="${basedir}/target" />
   <property name="dist.base"      location="${basedir}/target" />
   <property name="temp.dir"       location="${build.base}/temp" />
   <property name="version.file"   location="${forms.src}/version" />
   <property name="excludes.file"  location="${basedir}/exclude.list" />
   <property name="tns.admin"      value="${oracle.instance}/config" />
   <property name="forms_path"     value="${forms.src};${default.forms_path}" />
   <property name="reports_path"   value="${reports.src};${forms.src}" />
   <property name="git.executable"     value="git" />
   <property name="sqlplus.executable" value="sqlplus" />
   <property name="forms.runtime"  value="runtime" />
   <property name="reports.distfiles"   value="*.rep" />
   <property name="oformsci.verbose"    value="false" />
   <property name="oformsci.overwrite"  value="false" />
   <property name="oformsci.failonerror"   value="true" />
   <property name="oformsci.failimmediate" value="false" />

<!-- ===================================================================== -->

	<!-- get git revision information -->
	<exec executable="${git.executable}" outputproperty="git.desc">
	   <arg line="describe --always --dirty --first-parent" />
	</exec>
	<exec executable="${git.executable}" outputproperty="git.id">
	   <arg line="rev-parse --verify HEAD" />
	</exec>		
	<exec executable="${git.executable}" outputproperty="git.branch">
	   <arg line="rev-parse --abbrev-ref HEAD" />
	</exec>
	
<!-- ===================================================================== -->

	<!-- INIT -->
	<target name="init">
		<!-- Create the time stamp -->
		<tstamp/>
		<!-- Create the build directory structure -->
		<mkdir dir="${build.base}"/>
		<mkdir dir="${dist.base}"/>
		<mkdir dir="${temp.dir}"/>
		<!-- create the excludesfile it it does not exist -->
		<touch file="${excludes.file}" />
		<!-- always start with an empty version file -->
		<echo message="" file="${version.file}" append="false" />
	</target>

<!-- ===================================================================== -->

	<target name="check-password" description="fails build if db password is wrong" >
		<echo file="${temp.dir}/passwordcheck.sql">
			set heading off
			set pagesize 0
			set feedback off
			select 'Successfully connected as user '''||user||
			       ''' at '||sys_context('userenv','DB_NAME')||
				   '/'||sys_context('userenv','INSTANCE_NAME')||
				   ' on '||sys_context('userenv','SERVER_HOST') from dual;
		</echo>
		<exec executable="${sqlplus.executable}" failonerror="true" >
			<redirector input="${temp.dir}/passwordcheck.sql"/>
			<env key="ORACLE_HOME"       path="${oracle.home}" />
			<env key="ORACLE_INSTANCE"   path="${oracle.instance}" />
			<env key="TNS_ADMIN"         path="${tns.admin}" />
			<env key="NLS_LANG"          value="${nls.lang}" />
			<arg value="-L" />
			<arg value="-S" />
			<arg value="${db.userid}" />
		</exec>
	</target>
	
<!-- ===================================================================== -->

	<target name="compile-forms" depends="init,check-password" >
		<formsc verbose="${oformsci.verbose}"  overwrite="${oformsci.overwrite}" dbuserid="${db.userid}"
				formsCompiler="${forms.compiler}" reportsCompiler="${reports.compiler}" searchpath="true" 
				dir="${temp.dir}" failonerror="${oformsci.failonerror}" failimmediate="${oformsci.failimmediate}" >
			<env key="ORACLE_HOME"       path="${oracle.home}" />
			<env key="ORACLE_INSTANCE"   path="${oracle.instance}" />
			<env key="TNS_ADMIN"         path="${tns.admin}" />
			<env key="FORMS_PATH"   path="${forms_path}" />
			<env key="REPORTS_PATH" path="${reports_path}" />
			<env key="NLS_LANG" value="${nls.lang}" />
			<env key="ORACLE_TERM" value="vt220" />
			<env key="FORMS_API_TK_BYPASS" value="TRUE" />
			<!--
				If ${forms.src} and ${reports.src} are really different directories you may
                want add the path to your plls (${forms_path}) to ${reports_path} in build.properties.
		    -->
			<fileset dir="${forms.src}" casesensitive="no" excludesfile="${excludes.file}" >
				<include name="*.pll" />
				<include name="*.mmb" />
				<include name="*.fmb" />
			</fileset>
			<fileset dir="${reports.src}" casesensitive="no" excludesfile="${excludes.file}" >
				<include name="*.rdf" />
			</fileset>
		</formsc>
	</target>
	
<!-- ===================================================================== -->

	<target name="compile" description="compile everything" depends="compile-forms" >
		<!-- after successful compile of all components create the new version file -->
		<echo message="creating version ${git.desc}" />
		<echo message="${git.desc}" file="${version.file}" append="false" />	
	</target>
	
<!-- ===================================================================== -->

        <target name="icons-jar" description="Creates ${icons.jar}" >
	  <mkdir dir="${build.base}/java_unsigned" />
	  <jar destfile="${build.base}/java_unsigned/${icons.jar}" 
	       basedir="${icons.src}" >
	    <manifest>
	      <attribute name="Permissions" value="all-permissions" />
	      <attribute name="Codebase" value="*" />
	      <attribute name="Caller-Allowable-Codebase" value="*" />
	      <attribute name="Application-Library-Allowable-Codebase" value="*" />
	      <attribute name="Application-Name" value="${app.name}" />
	      <attribute name="Specification-Title"    value="${app.name} Icons" />
	      <attribute name="Specification-Vendor"   value="${app.vendor}" />
	      <attribute name="Specification-Version"  value="${git.desc}" />
	      <attribute name="Implementation-Version" value="${git.desc}" />
	      <attribute name="X-Git-Branch" value="${git.branch}" />
	      <attribute name="X-Git-Id" value="${git.id}" />
	    </manifest>
	  </jar>
	</target>
	

<!-- ===================================================================== -->

	<target name="build" description="create a usable directory structure below ${build.base}" depends="compile,icons-jar" >
		<copy todir="${build.base}/${forms.runtime}" >
			<fileset dir="${forms.src}" excludesfile="${excludes.file}" >
				<include name="*.plx"/>
				<include name="*.mmx"/>
				<include name="*.fmx"/>
				<include name="fmrweb.res"/>
				<include name="version"/>
			</fileset>
			<fileset dir="${reports.src}" includes="${reports.distfiles}" excludesfile="${excludes.file}"/>			
		</copy>
	</target>

<!-- ===================================================================== -->

        <target name="sign-icons-jar" depends="icons-jar"
		description="Sign ${icons.jar}" >
	  <fail message="Please adjust the file build.properties first! (sign.keystore)"            unless="sign.keystore" />
	  <fail message="Please adjust the file build.properties first! (sign.keystoretype)"        unless="sign.keystoretype" />
	  <fail message="Please adjust the file build.properties first! (sign.keyalias)"            unless="sign.keyalias" />
	  <fail message="Please adjust the file build.properties first! (sign.tsaurl)"              unless="sign.tsaurl" />
	  <fail message="Please adjust the file build.properties first! (sign.proxy.host.setting)"  unless="sign.proxy.host.setting" />
	  <fail message="Please adjust the file build.properties first! (sign.proxy.port.setting)"  unless="sign.proxy.port.setting" />

	  <input message="please type the signing keystore password:" addproperty="sign.keystore.passwd" >
		<handler classname="org.apache.tools.ant.input.SecureInputHandler" />
	  </input>

	  <mkdir dir="${build.base}/java" />

	  <exec executable="jarsigner" failonerror="true" >
	    <arg value="${sign.proxy.host.setting}" />
	    <arg value="${sign.proxy.port.setting}" />
	    <arg value="-keystore" />
	    <arg value="${sign.keystore}" />
	    <arg value="-storetype" />
	    <arg value="${sign.keystoretype}" />
	    <arg value="-storepass" />
	    <arg value="${sign.keystore.passwd}" />
	    <arg value="-tsa" />
	    <arg value="${sign.tsaurl}" />
	    <arg value="-signedjar" />
	    <arg value="${build.base}/java/${icons.jar}" />
	    <arg value="${build.base}/java_unsigned/${icons.jar}" />
	    <arg value="${sign.keyalias}" />
	  </exec>
	</target>

<!-- ===================================================================== -->

        <target name="dist" depends="build,sign-icons-jar" />

<!-- ===================================================================== -->
         <target name="clean" description="cleanup the compile result" >
		<delete>
			<fileset dir="${forms.src}" includes="*.plx" />
			<fileset dir="${forms.src}" includes="*.mmx" />
			<fileset dir="${forms.src}" includes="*.fmx" />
			<fileset dir="${forms.src}" includes="*.err" />
			<fileset dir="${reports.src}" includes="*.rep" />
		</delete>
		<delete dir="${build.base}" />
	
	</target>
<!-- ===================================================================== -->


</project>