Mega Code Archive

 
Categories / Java / Ant
 

UPortal ant script

<!--     Copyright (c) 2000-2009, Jasig, Inc.     See license distributed with this file and available online at     https://www.ja-sig.org/svn/jasig-parent/tags/rel-10/license-header.txt --> <!--  | Detailed help documenation lives in docs/antHelp.txt, please refer to this file or  | run 'ant help' for usage of this file.  |  | Comments in this file should be targeted to the maintenance of the build script.  +--> <project name="uPortal" default="help" basedir="." xmlns:up="urn:up-util-ant" xmlns:artifact="urn:maven-artifact-ant">     <fail message="build.properties does not exist, please copy build.properties.sample and fill in your settings.">         <condition>             <not>                 <available file="${basedir}/build.properties" />             </not>         </condition>     </fail>          <!--      | Load the build properties before the next fail tests since they check properties provided      | by the file.      +-->     <property environment="env" />     <property file="${basedir}/build.properties" />     <property name="jasig.tmpdir" value="${java.io.tmpdir}/jasig" />     <mkdir dir="${jasig.tmpdir}" />              <tempfile property="parentPomInstallMarker.file" destdir="${jasig.tmpdir}" prefix="uportal-parent.pom-" suffix="-marker" />          <!--      | Properties that describe the maven project      +-->     <property name="bootstrap.dir" value="${basedir}/bootstrap" />     <property name="bootstrap-pom.dir" value="${bootstrap.dir}/pom" />     <property name="uportal-impl.dir" value="${basedir}/uportal-impl" />     <property name="uportal-war.dir" value="${basedir}/uportal-war" />     <property name="uportal-portlets-overlay.dir" value="${basedir}/uportal-portlets-overlay" />     <property name="uportal-ear.dir" value="${basedir}/uportal-ear" />     <property name="uportal-ear-deployer.dir" value="${basedir}/uportal-ear-deployer" />     <property name="uportal-ant-tasks.dir" value="${basedir}/uportal-ant-tasks" />          <import file="${bootstrap.dir}/build_includes.xml" />     <!-- ----------------------------== Public Targets ----------------------------== -->     <target name="help" description="Prints information about using this ant build file.">         <loadfile property="helpMessage" srcFile="docs/antHelp.txt" />         <echo message="${helpMessage}" />     </target>     <target name="initportal" depends="prodPrompt" description="Runs all the targets necessary to deploy the portal and prepare the portal database">         <echo message="Initializing uPortal" />         <antcall target="deploy-ear">             <param name="removeExisting" value="true" />         </antcall>         <antcall target="initdb" />         <echo message="Finished initializing uPortal" />     </target>          <target name="initdb" depends="prodPrompt" description="Drops all tables, then runs all the targets necessary prepare the portal database">         <echo message="Initializing database" />         <antcall target="db" />         <antcall target="db-hibernate" />         <antcall target="i18n-db" />         <antcall target="db-import" />         <echo message="Finished initializing database" />     </target>          <target name="db-hibernate" depends="prodPrompt" description="Drops then creates Hibernate managed tables">         <antcall target="db-hibernate-portal" />         <antcall target="db-hibernate-stats" />     </target>          <target name="db-hibernate-portal" depends="prodPrompt" description="Drops then creates Hibernate managed tables for the portal">         <uportal-impl-macro>             <java fork="true" failonerror="true" dir="${uportal-impl.dir}" classname="org.jasig.portal.tools.dbloader.DataSourceSchemaExportRunner">                 <sysproperty key="log4j.configuration" value="command-line.log4j.properties" />                                  <classpath refid="uportal-impl-full.classpath" />                 <arg value="-b" />                 <arg value="portalDbHibernateExport" />                 <arg value="-e" />                 <arg value="-d" />                 <arg value="-c" />             </java>         </uportal-impl-macro>     </target>          <target name="db-hibernate-stats" depends="prodPrompt" description="Drops then creates Hibernate managed tables used for the database backed portal statistics">         <uportal-impl-macro>             <java fork="true" failonerror="true" dir="${uportal-impl.dir}" classname="org.jasig.portal.tools.dbloader.DataSourceSchemaExportRunner">                 <sysproperty key="log4j.configuration" value="command-line.log4j.properties" />                                  <classpath refid="uportal-impl-full.classpath" />                 <arg value="-b" />                 <arg value="statsDbHibernateExport" />                 <arg value="-e" />                 <arg value="-d" />                 <arg value="-c" />                 <arg value="-i" />             </java>         </uportal-impl-macro>     </target>     <target name="db" depends="prodPrompt" description="Loads database tables and data">         <uportal-impl-macro>             <property name="usetable" value="-t" />             <property name="tablefile" value="/properties/db/tables.xml" />             <property name="usedata" value="-d" />             <property name="datafile" value="/properties/db/data.xml" />             <property name="createscript" value=" " />             <property name="droptables" value="-D" />             <property name="createtables" value="-C" />             <property name="populatetables" value="-P" />             <echo message="Invoking DbLoader" />             <java fork="true" failonerror="true" dir="${uportal-impl.dir}" classname="org.jasig.portal.tools.dbloader.DbLoaderRunner">                 <sysproperty key="log4j.configuration" value="command-line.log4j.properties" />                                  <classpath refid="uportal-impl-full.classpath" />                 <arg value="${usetable}" />                 <arg value="${tablefile}" />                 <arg value="${usedata}" />                 <arg value="${datafile}" />                 <arg value="${createscript}" />                 <arg value="${droptables}" />                 <arg value="${createtables}" />                 <arg value="${populatetables}" />             </java>         </uportal-impl-macro>     </target>     <target name="i18n-db" depends="prodPrompt" description="Loads internationalization tables and data">         <echo message="Invoking DbLoader for localizationed database setting" />         <antcall target="db">             <param name="usetable" value="-t" />             <param name="tablefile" value="/properties/db/tables-i18n.xml" />             <param name="usedata" value="-d" />             <param name="datafile" value="/properties/db/data-i18n.xml" />             <param name="droptables" value="-D" />             <param name="createtables" value="-C" />             <param name="populatetables" value="-P" />         </antcall>     </target>     <target name="db-import" depends="prodPrompt" description="Imports the default XML files to the database">         <echo message="Importing data" />         <antcall target="crn-import">             <param name="dir" value="${basedir}/uportal-impl/src/main/resources/properties/db/entities" />         </antcall>     </target>     <target name="dbtest" description="Displays information about the database defined in rdbm.properties">         <uportal-impl-macro>             <echo message="Invoking DbTest" />             <java fork="true" failonerror="true" dir="${basedir}" classname="org.jasig.portal.tools.DbTest">                 <sysproperty key="log4j.configuration" value="command-line.log4j.properties" />                                                  <classpath refid="uportal-impl-full.classpath" />             </java>         </uportal-impl-macro>     </target>     <target name="regchantype" depends="prodPrompt" description="Registers a new channel type">         <uportal-impl-macro>             <property name="class" value=" " />             <property name="name" value=" " />             <property name="description" value=" " />             <property name="uri" value=" " />             <echo message="Invoking RegisterChannelType" />             <java dir="${basedir}" classname="org.jasig.portal.tools.RegisterChannelType">                 <classpath refid="uportal-impl-full.classpath" />                 <arg value="${class}" />                 <arg value="${name}" />                 <arg value="${description}" />                 <arg value="${uri}" />             </java>         </uportal-impl-macro>     </target>          <target name="crn-export" description="Exports the specified entity or entities to XML on the file system">         <uportal-impl-macro>             <!-- Three properties control the export:  dir, type, and sysid -->             <fail unless="type">                 You must specify a &quot;type&quot; parameter (-Dtype={something}) from the following:  all, layout,                 all-layouts, channel, all-channels, all-permissions,  all-memberships, group, all-groups, user,                  all-users.             </fail>                              <property name="dir" value="." />             <property name="sysid" value="" />             <!-- Invoke Cernunnos specifying script and parameters -->             <java fork="true" failonerror="true" dir="${basedir}" classname="org.danann.cernunnos.runtime.Main">                 <sysproperty key="log4j.configuration" value="command-line.log4j.properties" />                 <classpath refid="uportal-impl-full.classpath" />                 <arg value="classpath://org/jasig/portal/io/export.crn" />                 <arg value="${dir}" />                 <arg value="${type}" />                 <arg value="${sysid}" />             </java>         </uportal-impl-macro>     </target>     <target name="crn-import" depends="prodPrompt" description="Imports the specified XML file or files">         <uportal-impl-macro>             <!-- Two properties control the import:  dir and pattern -->             <property name="dir" value="." />             <property name="pattern" value="org.jasig.portal.FilePatternPhrase.USE_DEFAULT_VALUE "/>             <!-- Invoke Cernunnos specifying script and parameters -->             <java fork="true" failonerror="true" dir="${basedir}" classname="org.danann.cernunnos.runtime.Main">                 <sysproperty key="log4j.configuration" value="command-line.log4j.properties" />                 <classpath refid="uportal-impl-full.classpath" />                 <arg value="classpath://org/jasig/portal/io/import.crn" />                 <arg value="${dir}" />                 <arg value="${pattern}" />             </java>         </uportal-impl-macro>     </target>     <target name="crn-delete" depends="prodPrompt" description="Deletes the specified entity">         <uportal-impl-macro>             <fail unless="type">                 You must specify a &quot;type&quot; parameter (-Dtype={something}) from the following:  layout, channel,                 group, user.             </fail>                          <fail unless="sysid">                 You must specify a &quot;sysid&quot; parameter (-Dsysid={something}).  The value will be a valid username                 (user or layout), fname (channel), or name (group).             </fail>             <!-- Invoke Cernunnos specifying script and parameters -->             <java fork="true" failonerror="true" dir="${basedir}" classname="org.danann.cernunnos.runtime.Main">                 <classpath refid="uportal-impl-full.classpath" />                 <arg value="classpath://org/jasig/portal/io/delete.crn" />                 <arg value="${type}" />                 <arg value="${sysid}" />             </java>         </uportal-impl-macro>     </target>          <target name="clean-shared" depends="checkForTomcat" description="Removes the ALL shared libraries from the container.">         <delete>             <fileset dir="${server.base}/shared/lib">                 <include name="*"/>             </fileset>         </delete>     </target>          <target name="clean-tomcat" depends="checkForTomcat" description="Removes the deployed uPortal from the container">         <uportal-parent-macro>             <!-- Clean out uPortal from Tomcat -->             <artifact:pom file="${uportal-war.dir}/pom.xml" id="uportal-war.pom" />             <property name="destDir" value="${server.base}/webapps/${uportal-war.pom.build.finalName}" />             <echo>Deleting '${destDir}'</echo>             <delete dir="${destDir}" />         </uportal-parent-macro>     </target>          <target name="clean" description="Runs 'mvn clean'">         <!-- Execute the mvn clean lifecycle -->         <antcall target="mvn">             <param name="pomDir" value="${basedir}" />             <param name="goal" value="clean" />         </antcall>     </target>     <target name="deploy-ear" depends="checkForTomcat" description="Deploy uPortal and dependent libraries and portlets to the servlet container">         <uportal-ant-tasks-macro>             <typedef resource="org/jasig/portal/ant/antlib.xml" uri="urn:up-util-ant">                 <classpath refid="uportal-ant-tasks-full.classpath" />             </typedef>             <uportal-ear-macro>                 <echo message="   extractWars=${extractWars}" />                 <echo message="removeExisting=${removeExisting}" />                 <echo message="   cleanShared=${cleanShared}" />                                      <if>                     <equals arg1="${cleanShared}" arg2="true" />                     <then>                         <antcall target="clean-shared" />                     </then>                 </if>                 <up:tomcatEarDeploy ear="${uportal-ear.artifact}" catalinaBase="${server.base}" webAppsDir="${server.webapps}" extractWars="${extractWars}" removeExistingDirectories="${removeExisting}" />             </uportal-ear-macro>         </uportal-ant-tasks-macro>     </target>     <target name="deploy-war" depends="checkForTomcat" description="Deploy the uPortal web application to the servlet container">         <uportal-war-macro>             <antcall target="fastWarDeploy">                 <param name="warPath" value="${uportal-war.artifact}"/>             </antcall>         </uportal-war-macro>     </target>     <target name="deployPortletApp" depends="checkForTomcat" description="Deploys a portlet application">         <!-- Check arguments -->         <fail message="'-DportletApp=[WAR File]' must be specified">             <condition>                 <not>                     <isset property="portletApp" />                 </not>             </condition>         </fail>                  <if>             <available file="${user.dir}/${portletApp}" />             <then>                 <property name="portletAppPath" location="${user.dir}/${portletApp}"/>             </then>             <else>                 <property name="portletAppPath" location="${portletApp}"/>             </else>         </if>         <fail message="portletApp '${portletAppPath}' does not exist">             <condition>                 <not>                     <available file="${portletAppPath}" />                 </not>             </condition>         </fail>         <basename property="war.filename" file="${portletAppPath}" />         <uportal-parent-macro>             <artifact:dependencies pathid="pluto-ant" verbose="false">                 <pom file="${bootstrap-pom.dir}/pluto-assembler-pom.xml" />             </artifact:dependencies>                  <taskdef classname="org.apache.pluto.ant.AssembleTask" name="assemblePortlet">                 <classpath>                     <path refid="pluto-ant" />                 </classpath>             </taskdef>         </uportal-parent-macro>         <assemblePortlet destdir="${jasig.tmpdir}" war="${portletAppPath}" />                      <antcall target="fastWarDeploy">             <param name="warPath" value="${jasig.tmpdir}/${war.filename}"/>         </antcall>                  <delete file="${jasig.tmpdir}/${war.filename}" />     </target>     <target name="md5passwd" depends="prodPrompt" description="Creates a user in the UP_PERSON_DIR table">         <uportal-impl-macro>             <property name="username" value=" " />             <echo message="Invoking Md5Passwd" />             <java dir="${basedir}" classname="org.jasig.portal.security.Md5Passwd">                 <classpath refid="uportal-impl-full.classpath" />                 <arg value="-c" />                 <arg value="${username}" />             </java>         </uportal-impl-macro>     </target>     <target name="deluser" depends="prodPrompt" description="Delete traces of a user from the portal database">         <uportal-impl-macro>             <property name="user" value=" " />             <echo message="Invoking DeleteUser" />             <java dir="${basedir}" classname="org.jasig.portal.tools.DeleteUser" fork="true">                 <classpath refid="uportal-impl-full.classpath" />                 <arg value="${user}" />             </java>         </uportal-impl-macro>     </target>     <target name="addstylesheet" depends="prodPrompt" description="Registers a new theme or structure">         <uportal-impl-macro>             <property name="stylesheetType" value=" " />             <property name="stylesheetUri" value=" " />             <property name="descriptionUri" value=" " />             <echo message="Invoking RegisterStylesheet (add)" />             <java dir="${basedir}" fork="true" classname="org.jasig.portal.tools.RegisterStylesheet">                 <classpath refid="uportal-impl-full.classpath" />                 <arg value="${stylesheetType}" />                 <arg value="${stylesheetUri}" />                 <arg value="${descriptionUri}" />             </java>         </uportal-impl-macro>     </target>     <target name="modstylesheet" depends="prodPrompt" description="Modifies an existing theme or structure">         <uportal-impl-macro>             <property name="stylesheetType" value=" " />             <property name="stylesheetUri" value=" " />             <property name="descriptionUri" value=" " />             <property name="stylesheetId" value=" " />             <echo message="Invoking RegisterStylesheet (modify)" />             <java dir="${basedir}" fork="true" classname="org.jasig.portal.tools.RegisterStylesheet">                 <classpath refid="uportal-impl-full.classpath" />                 <arg value="${stylesheetType}" />                 <arg value="-u" />                 <arg value="${stylesheetUri}" />                 <arg value="${descriptionUri}" />                 <arg value="${stylesheetId}" />             </java>         </uportal-impl-macro>     </target>     <target name="delstylesheet" depends="prodPrompt" description="Deletes an existing theme or structure">         <uportal-impl-macro>             <property name="stylesheetType" value=" " />             <property name="stylesheetId" value=" " />             <echo message="Invoking RegisterStylesheet (delete)" />             <java dir="${basedir}" classname="org.jasig.portal.tools.RegisterStylesheet">                 <classpath refid="uportal-impl-full.classpath" />                 <arg value="${stylesheetType}" />                 <arg value="-d" />                 <arg value="${stylesheetId}" />             </java>         </uportal-impl-macro>     </target>     <target name="hsql" description="Start a HSQLDB instance consistent with the default RDBMS requirements of uPortal">         <property name="spawn" value="false" />                  <condition property="failonerror" value="false">             <equals arg1="${spawn}" arg2="true" />         </condition>         <property name="failonerror" value="true" />                      <uportal-parent-macro>             <artifact:dependencies pathid="hsql.classpath" verbose="false">                 <pom file="${bootstrap-pom.dir}/hsqldb-pom.xml" />             </artifact:dependencies>                  <property name="database" value="${basedir}/data/uP3_uPortal" />             <property name="port" value="8887" />                  <echo message="Starting HSQL" />             <echo message="Using: ${database}" />             <java fork="true" spawn="${spawn}"  maxmemory="16M" dir="${basedir}" classname="org.hsqldb.Server" failonerror="${failonerror}">                 <classpath refid="hsql.classpath" />                      <arg value="-database" />                 <arg value="${database}" />                 <arg value="-port" />                 <arg value="${port}" />             </java>         </uportal-parent-macro>     </target>          <target name="hsql-shutdown" description="Compacts then cleanly shuts down hsql, useful if the 'hsql' task was run with '-Dspawn=true'">         <uportal-parent-macro>             <artifact:dependencies pathid="hsql.classpath" verbose="false">                 <pom file="${bootstrap-pom.dir}/hsqldb-pom.xml" />             </artifact:dependencies>                  <echo message="Stopping HSQL" />             <trycatch reference="hsql-shutdown.exceptionId">                 <try>                     <java fork="true" maxmemory="8M" dir="${basedir}" classname="org.hsqldb.util.SqlTool" timeout="5000" errorproperty="hsql-shutdown.err.out" failonerror="true">                         <classpath refid="hsql.classpath" />                                                  <arg value="--rcFile" />                         <arg value="${bootstrap.dir}/hsqldb.sqltool.rc" />                         <arg value="--sql" />                         <arg value="shutdown compact" />                         <arg value="uPortalDb" />                     </java>                 </try>                 <catch>                     <if>                         <contains string="${hsql-shutdown.err.out}" substring="java.sql.SQLException: socket creation error" />                         <then>                             <echo>HSQL is not running</echo>                         </then>                         <else>                             <echo>${jvm.err.out}</echo>                             <throw refid="hsql-shutdown.exceptionId" />                         </else>                     </if>                 </catch>             </trycatch>         </uportal-parent-macro>     </target>     <!-- ----------------------------== Utility Targets ----------------------------== -->     <!--      | Utility to deploy a WAR to the container where the delete and the replacement happen      | as close together as possible.      +-->     <target name="fastWarDeploy">         <fail message="'-DwarPath=[WAR File]' must be specified">             <condition>                 <not>                     <isset property="warPath" />                 </not>             </condition>         </fail>         <basename property="war.contextname" file="${warPath}" suffix=".war" />         <property name="war.dest" value="${server.webapps}/${war.contextname}" />                  <echo message="   extractWars=${extractWars}" />         <echo message="removeExisting=${removeExisting}" />         <if>             <os family="windows" />             <then>                 <if>                     <istrue value="${removeExisting}" />                     <then>                         <delete dir="${war.dest}" failonerror="false" />                         <delete file="${war.dest}.war" failonerror="false" />                     </then>                 </if>                                  <if>                     <istrue value="${extractWars}" />                     <then>                         <mkdir dir="${war.dest}" />                         <unwar dest="${war.dest}" src="${warPath}" overwrite="true" />                     </then>                     <else>                         <copy file="${warPath}" todir="${server.webapps}" />                     </else>                 </if>             </then>             <else>                 <if>                     <istrue value="${extractWars}" />                     <then>                         <property name="tempWarDir" value="${jasig.tmpdir}/${war.contextname}" />                                                  <delete dir="${tempWarDir}" />                         <mkdir dir="${tempWarDir}" />                         <unwar dest="${tempWarDir}" src="${warPath}" overwrite="true" />                                                  <if>                             <istrue value="${removeExisting}" />                             <then>                                 <delete dir="${war.dest}" />                                 <delete file="${war.dest}.war" />                             </then>                         </if>                                          <echo message="Moving ${tempWarDir} to ${server.webapps}" />                         <move todir="${server.webapps}" file="${tempWarDir}" />                     </then>                     <else>                         <if>                             <istrue value="${removeExisting}" />                             <then>                                 <delete dir="${war.dest}" />                                 <delete file="${war.dest}.war" />                             </then>                         </if>                                              <copy file="${warPath}" todir="${server.webapps}" />                     </else>                 </if>             </else>         </if>     </target>          <target name="prodPrompt">         <if>             <and>                 <istrue value="${prodPrompt}" />                 <not>                     <isset property="continueWithProdTarget" />                 </not>             </and>             <then>                 <echo>WARNING: This task may change or destroy data and should be run with care in production environments.</echo>                 <input message="Do you want to continue: " validargs="y,n" addproperty="continueWithProdTarget"/>                 <condition property="do.abort">                     <equals arg1="n" arg2="${continueWithProdTarget}"/>                 </condition>                 <fail if="do.abort">Task aborted by user.</fail>             </then>         </if>     </target>          <target name="checkForTomcat">         <fail message="server.base build property must be set.">             <condition>                 <not>                     <isset property="server.base" />                 </not>             </condition>         </fail>         <fail message="The server.base build property refers to a non-existant location '${server.base}'">             <condition>                 <not>                     <available file="${server.base}" type="dir" />                 </not>             </condition>         </fail>     </target>     <!-- ----------------------------== Deprecated Targets ----------------------------== -->     <target name="all">         <echo>The "all" Ant task is no longer supported. Run 'mvn clean compile' for the same result.</echo>         <fail message="The 'all' Ant task is no longer supported. Run 'mvn clean compile' for the same result.">         </fail>     </target>     <target name="compile">         <echo>The "compile" Ant task is no longer supported. Run 'mvn compile' for the same result.</echo>         <fail message="The 'compile' Ant task is no longer supported. Run 'mvn compile' for the same result.">         </fail>     </target>     <target name="compiletests">         <echo>The "compiletests" Ant task is no longer supported. Run 'mvn test-compile' for the same result.</echo>             <fail message="The 'compiletests' Ant task is no longer supported. Run 'mvn test-compile' for the same result.">             </fail>     </target>     <target name="deploy">         <echo>The "deploy" Ant task is no longer supported. Run 'ant deploy-war' for the same result.</echo>         <fail message="The 'deploy' Ant task is no longer supported. Run 'ant deploy-war' for the same result.">         </fail>     </target>     <target name="dist">         <echo>The "dist" Ant task is no longer supported. Run 'mvn package site' for a similar result.</echo>         <fail message="The 'dist' Ant task is no longer supported. Run 'mvn package site' for the same result.">         </fail>     </target>     <target name="javadoc">         <echo>The "javadoc" Ant task is no longer supported. Run 'mvn javadoc:javadoc' for the same result.</echo>         <fail message="The 'javadoc' Ant task is no longer supported. Run 'mvn javadoc:javadoc' for the same result.">         </fail>     </target>     <target name="runtests">         <echo>The "runtests" Ant task is no longer supported. Run 'mvn test' for the same result.</echo>         <fail message="The 'runtests' Ant task is no longer supported. Run 'mvn test' for the same result.">         </fail>     </target>     <target name="pubchan">         <echo>The "pubchan" Ant task is no longer supported. Use 'ant crn-import' to publish channel entity XML files.</echo>         <fail message="The 'pubchan' Ant task is no longer supported. Run 'ant crn-import' for the same result.">         </fail>    </target>     <!-- ----------------------------== Maven Support Macros ----------------------------== -->          <!--      | Macro that simply calls the install-root-pom target using an 'ant' task instead of the      | 'antcall' task to ensure the Maven tasks aren't tainted by a failed loading of the parent      | pom.      +-->     <macrodef name="uportal-parent-macro">         <element name="sub-tasks" optional="false" implicit="true" />         <sequential>             <!--              | Called via the <ant> task so the install happens in a different classloader. This              | is required so an initial install which is missing jasig-parent doesn't cause problems              | later due to the failed load of jasig-parent being cached.                +-->             <if>                 <not>                     <available file="${parentPomInstallMarker.file}" />                 </not>                 <then>                     <ant antfile="${basedir}/build.xml" target="install-parent-pom" />                     <touch file="${parentPomInstallMarker.file}" />                 </then>             </if>             <sub-tasks />         </sequential>     </macrodef>          <target name="install-parent-pom">         <artifact:pom file="${basedir}/pom.xml" id="uportal-parent.pom" />         <artifact:install file="${basedir}/pom.xml" pomrefid="uportal-parent.pom" />     </target>          <!--      | Macro for tasks involving a maven project. The macro loads the pom, creates a classpath,      | ensures the project artifact is up-to-date, and runs the <sub-tasks> element. If the      | artifact is not up-to-date the <pre-package> element can be used to add behavior before      | 'mvn package' is called on the project.      |      | The following are available in the pre-package and sub-tasks elements:      | pom object   - @{project-name}.pom       - The Maven POM object for the project      | property     - @{project-name}.artifact  - The full path to the final artifact      | path         - @{project-name}.classpath - The projects classpath not including the artifact      +-->     <macrodef name="maven-artifact-macro">         <attribute name="project-name" />         <attribute name="project-path" />         <attribute name="checkFilesId" default="null" />         <element name="sub-tasks" optional="true" implicit="true" />         <sequential>             <!--              | Load the pom & classpath              +-->             <artifact:pom file="@{project-path}/pom.xml" id="@{project-name}.pom" />             <artifact:dependencies pathid="@{project-name}.classpath" verbose="false">                 <pom refid="@{project-name}.pom" />             </artifact:dependencies>             <!--              | Define the location of the resulting artifact              +-->             <property name="@{project-name}.artifact" value="${@{project-name}.pom.build.directory}/${@{project-name}.pom.build.finalName}.${@{project-name}.pom.packaging}" />             <!--              | Parse out the target directory without the preceding project path              +-->             <length property="@{project-name}.path.length" string="@{project-path}/" />             <propertyregex property="@{project-name}.build.directory" input="${@{project-name}.pom.build.directory}" regexp=".{${@{project-name}.path.length}}(.*)" select="\1" />             <!--              | Do uptodate checking for project files and dependencies              +-->             <uptodate property="@{project-name}.projectFilesUTD" targetfile="${@{project-name}.artifact}">                 <srcfiles dir="@{project-path}" defaultexcludes="true">                     <exclude name="${@{project-name}.build.directory}/" />                 </srcfiles>             </uptodate>             <if>                 <not>                     <equals arg1="@{checkFilesId}" arg2="null" />                 </not>                 <then>                     <uptodate property="@{project-name}.dependenciesUTD" targetfile="${@{project-name}.artifact}">                         <srcfiles refid="@{checkFilesId}" />                     </uptodate>                 </then>                 <else>                     <property name="@{project-name}.dependenciesUTD" value="true" />                 </else>             </if>             <!--              | Call 'mvn package' if files in the project are not up-to-date              +-->             <if>                 <not>                     <and>                         <equals arg1="${@{project-name}.projectFilesUTD}" arg2="true" />                         <equals arg1="${@{project-name}.dependenciesUTD}" arg2="true" />                     </and>                 </not>                 <then>                     <echo message="Artifact '${@{project-name}.artifact}' is not available or out-of-date, calling 'mvn install'" />                     <!--                      | Force the target artifact to be re-built by deleting it.                      +-->                     <delete file="${@{project-name}.artifact}" />                     <antcall target="mvn">                         <param name="pomDir" value="@{project-path}" />                         <param name="goal" value="install" />                     </antcall>                 </then>                 <else>                     <echo message="Artifact '${@{project-name}.artifact}' is up-to-date" />                     <artifact:install file="${@{project-name}.artifact}" pomrefid="@{project-name}.pom" />                 </else>             </if>             <!--              | Execute the sub-tasks              +-->             <sub-tasks />         </sequential>     </macrodef>     <!--      | Provides a wrapper for tasks that need a classpath that includes the uPortal source      | and all of its dependencies. The task also ensures the uportal-impl JAR exists and      | is up to date.      |      | The following are available in the impl-sub-tasks element:      | pom object   - uportal-impl.pom                      - The Maven POM object for the uportal-impl pom      | property     - uportal-impl.artifact                 - The full path to the uportal-impl JAR      | path         - uportal-impl.classpath                - The uportal-impl classpath not including the uportal-impl JAR      | path         - uportal-impl-full.classpath           - The uportal-impl classpath including the uportal-impl JAR      +-->     <macrodef name="uportal-impl-macro">         <element name="impl-sub-tasks" optional="false" implicit="true" />         <sequential>             <uportal-parent-macro>                 <fileset id="uportal-parent.pom.fsid" file="${basedir}/pom.xml" />                                  <maven-artifact-macro project-name="uportal-impl" project-path="${uportal-impl.dir}" checkfilesid="uportal-parent.pom.fsid">                     <!--                      | Include the uportal-impl JAR in the final classpath                      +-->                     <path id="uportal-impl-full.classpath">                         <path refid="uportal-impl.classpath" />                         <pathelement location="${uportal-impl.artifact}" />                     </path>                          <!--                      | Execute the impl-sub-tasks                      +-->                     <impl-sub-tasks />                 </maven-artifact-macro>             </uportal-parent-macro>         </sequential>     </macrodef>     <!--      | Provides a wrapper for tasks that need a classpath that includes all of the uPortal WAR      | dependencies. The task also ensures the uportal-war WAR exists and is up to date.      |      | The following are available in the war-sub-tasks element:      | properties from the uportal-impl-macro macrodef      | pom object   - uportal-war.pom                       - The Maven POM object for the uportal-war pom      | property     - uportal-war.artifact                  - The full path to the uportal-war WAR      | path         - uportal-war.classpath                 - The uportal-war classpath not including the uportal-war WAR      +-->     <macrodef name="uportal-war-macro">         <element name="war-sub-tasks" optional="false" implicit="true" />         <sequential>             <uportal-impl-macro>                 <fileset id="uportal-impl-artifacts" file="${uportal-impl.artifact}" />                 <maven-artifact-macro project-name="uportal-war" project-path="${uportal-war.dir}" checkfilesid="uportal-impl-artifacts">                     <!--                      | Execute the war-sub-tasks                      +-->                     <war-sub-tasks />                 </maven-artifact-macro>             </uportal-impl-macro>         </sequential>     </macrodef>     <!--      | Provides a wrapper for tasks that depend on the portlet overlays being installed and up-to-date.      |      | No properties are set for the overlay-sub-tasks element.      +-->     <macrodef name="uportal-portlets-overlay-macro">         <element name="overlay-sub-tasks" optional="false" implicit="true" />         <sequential>             <uportal-parent-macro>                 <!--                  | Install the overlay parent project pom                  +-->                 <artifact:pom file="${uportal-portlets-overlay.dir}/pom.xml" id="uportal-portlets-overlay.pom" />                 <artifact:install file="${uportal-portlets-overlay.dir}/pom.xml" pomrefid="uportal-portlets-overlay.pom" />                                  <fileset id="uportal-portlets-overlay.pom.fsid" dir="${basedir}">                     <filename name="${basedir}/pom.xml"/>                     <filename name="${uportal-portlets-overlay.dir}/pom.xml"/>                 </fileset>                                  <!--                  | Iterate over the child projects and run the artifact macro on each of them                  +-->                 <for param="portlet-overlay-dir">                     <path>                         <dirset dir="${uportal-portlets-overlay.dir}">                             <include name="*"/>                         </dirset>                     </path>                     <sequential>                         <if>                             <available file="@{portlet-overlay-dir}/pom.xml" />                             <then>                                 <basename file="@{portlet-overlay-dir}" property="@{portlet-overlay-dir}-name" />                                 <maven-artifact-macro project-name="${@{portlet-overlay-dir}-name}" project-path="@{portlet-overlay-dir}" checkfilesid="uportal-portlets-overlay.pom.fsid" />                             </then>                         </if>                     </sequential>                 </for>                                  <fileset id="portletWars.fsid" dir="${uportal-portlets-overlay.dir}">                     <include name="*/target/*.war"/>                 </fileset>                                  <!--                  | Execute the overlay-sub-tasks                  +-->                 <overlay-sub-tasks />             </uportal-parent-macro>         </sequential>     </macrodef>          <!--      | Provides a wrapper for tasks that need a classpath that includes all of the uPortal EAR      | dependencies. The task also ensures the uportal-ear EAR exists and is up to date.      |      | The following are available in the ear-sub-tasks element:      | properties from the uportal-war-macro macrodef      | pom object   - uportal-ear.pom               - The Maven POM object for the uportal-ear pom      | property     - uportal-ear.artifact          - The full path to the uportal-ear EAR      | path         - uportal-ear.classpath         - The uportal-ear classpath not including the uportal-ear EAR      +-->     <macrodef name="uportal-ear-macro">         <element name="ear-sub-tasks" optional="false" implicit="true" />         <sequential>             <uportal-war-macro>                 <uportal-portlets-overlay-macro>                     <fileset id="uportal-war-artifacts" file="${uportal-war.artifact}" />                                          <maven-artifact-macro project-name="uportal-ear" project-path="${uportal-ear.dir}" checkfilesid="uportal-war-artifacts">                         <!--                          | Execute the ear-sub-tasks                          +-->                         <ear-sub-tasks />                     </maven-artifact-macro>                 </uportal-portlets-overlay-macro>             </uportal-war-macro>         </sequential>     </macrodef>     <!--      | Provides a wrapper for tasks that need a classpath that includes the uPortal ear deployer      | and all of its dependencies. The task also ensures the uportal-impl JAR exists and      | is up to date.      |      | The following are available in the ear-deployer-sub-tasks element:      | pom object   - uportal-ear-deployer.pom              - The Maven POM object for the uportal-ear-deployer pom      | property     - uportal-ear-deployer.artifact         - The full path to the uportal-ear-deployer JAR      | path         - uportal-ear-deployer.classpath        - The uportal-ear-deployer classpath not including the uportal-ear-deployer JAR      | path         - uportal-ear-deployer-full.classpath   - The uportal-impl classpath including the uportal-impl JAR      +-->     <macrodef name="uportal-ear-deployer-macro">         <element name="ear-deployer-sub-tasks" optional="false" implicit="true" />         <sequential>             <uportal-parent-macro>                 <fileset id="uportal-parent.pom.fsid" file="${basedir}/pom.xml" />                                  <maven-artifact-macro project-name="uportal-ear-deployer" project-path="${uportal-ear-deployer.dir}" checkfilesid="uportal-parent.pom.fsid">                     <!--                      | Include the uportal-ear-deployer JAR in the final classpath                      +-->                     <path id="uportal-ear-deployer-full.classpath">                         <path refid="uportal-ear-deployer.classpath" />                         <pathelement location="${uportal-ear-deployer.artifact}" />                     </path>                          <!--                      | Execute the ear-deployer-sub-tasks                      +-->                     <ear-deployer-sub-tasks />                 </maven-artifact-macro>             </uportal-parent-macro>         </sequential>     </macrodef>     <!--      | Provides a wrapper for tasks that need a classpath that includes all of the uPortal WAR      | dependencies. The task also ensures the uportal-war WAR exists and is up to date.      |      | The following are available in the ant-tasks-sub-tasks element:      | properties from the uportal-ear-deployer-macro macrodef      | pom object   - uportal-ant-tasks.pom                 - The Maven POM object for the uportal-ant-tasks pom      | property     - uportal-ant-tasks.artifact            - The full path to the uportal-ant-tasks JAR      | path         - uportal-ant-tasks.classpath           - The uportal-ant-tasks classpath not including the uportal-ant-tasks WAR      | path         - uportal-ant-tasks-full.classpath      - The uportal-ant-tasks classpath including the uportal-ant-tasks JAR      +-->     <macrodef name="uportal-ant-tasks-macro">         <element name="ant-tasks-sub-tasks" optional="false" implicit="true" />         <sequential>             <uportal-ear-deployer-macro>                 <fileset id="uportal-ear-deployer-artifacts" file="${uportal-ear-deployer.artifact}" />                 <maven-artifact-macro project-name="uportal-ant-tasks" project-path="${uportal-ant-tasks.dir}" checkfilesid="uportal-ear-deployer-artifacts">                     <!--                      | Include the uportal-ear-deployer JAR in the final classpath                      +-->                     <path id="uportal-ant-tasks-full.classpath">                         <path refid="uportal-ant-tasks.classpath" />                         <pathelement location="${uportal-ant-tasks.artifact}" />                     </path>                     <!--                      | Execute the ant-tasks-sub-tasks                      +-->                     <ant-tasks-sub-tasks />                 </maven-artifact-macro>             </uportal-ear-deployer-macro>         </sequential>     </macrodef>          <!--      | Utility target for executing a maven with some number (up to 10) of goals. The      | target should automaticly work on all OSs as long as 'mvn' is on the path.      +-->     <target name="mvn">         <property name="goal" value="" />         <property name="goal1" value="" />         <property name="goal2" value="" />         <property name="goal3" value="" />         <property name="goal4" value="" />         <property name="goal5" value="" />         <property name="goal6" value="" />         <property name="goal7" value="" />         <property name="goal8" value="" />         <property name="goal9" value="" />         <if>             <os family="windows" />             <then>                 <property name="mvnExecutable" value="mvn.bat" />             </then>             <else>                 <property name="mvnExecutable" value="mvn" />             </else>         </if>                  <condition property="maven.bin" value="${maven.home}/bin/">             <isset property="maven.home"/>         </condition>         <property name="maven.bin" value="" />                  <condition property="test.skip" value="-Dmaven.test.skip=true">             <isset property="maven.test.skip"/>         </condition>         <property name="test.skip" value="-Djasig" />                  <condition property="offline" value="-o">             <isset property="maven.offline"/>         </condition>         <property name="offline" value="-Djasig" />                  <exec executable="${maven.bin}${mvnExecutable}" dir="${pomDir}" vmlauncher="true" resolveexecutable="true" searchpath="true" failonerror="true">             <env key="MAVEN_TERMINATE_CMD" value="on" />             <arg value="${test.skip}" />             <arg value="${offline}" />             <arg value="${goal}" />             <arg value="${goal1}" />             <arg value="${goal2}" />             <arg value="${goal3}" />             <arg value="${goal4}" />             <arg value="${goal5}" />             <arg value="${goal6}" />             <arg value="${goal7}" />             <arg value="${goal8}" />             <arg value="${goal9}" />         </exec>     </target> </project> File: build.properties.sample # # Modify this file to suit your environment. # The values of these properties will # override the values of properties of the # same name in the build.xml file. # # Use forward slashes for path names even if # you are in a Windows environment! # #-------------------- File and Directory Names ------------------------ ##### Replace server.home with the location of Tomcat 6 on your machine ##### # path to tomcat binaries server.home=@server.home@ # path to tomcat servlet container (defaults to same directory as the tomcat binaries) server.base=${server.home} # path to webapps directory (defaults to /webapps under the tomcat path) server.webapps=${server.base}/webapps # If the mvn executable isn't on your path you can set the location here or set it on your path. #maven.home= ######## Deployment Configuration ########## # The following apply to deployPortletApp, deploy-war, and deploy-ear targets # Should the deployment tools extract the WARs when copying them into the servlet container  extractWars=true # Should the existing webapp be removed before deploying the new webapp removeExisting=true # The following applies to the clean and deploy-ear targets. # Should the shared library location have all existing files removed when clean is run. # NOTE: Tomcat 6.0 does not include any libraries in shared/lib by default so as long as #       all required libraries are declared in the uportal-ear it is ok to set this to true. cleanShared=false # Prompt the user before running ant tasks that could modify the database prodPrompt=false