Skip to content

Use Ant to build Geoportal

Marten Hogeweg edited this page Dec 16, 2012 · 2 revisions

To carry out these instructions, you will need to download the build_from_ant.zip file.

Note: The original scripts and instructions were provided by Ryan Clark at the Arizona Geological Survey - see https://github.com/usgin/usgin-geoportal-addon/blob/master/README.md

Purpose

  • Provide an efficient mechanism for building the Geoportal web application from source code
  • Simplify the installation process by making the following assumptions about the setup environment:
    • You are using Tomcat
    • You are using PostgreSQL
    • You would like the geoportal to use a single Administrative user, rather than a managed LDAP authentication system (see Simple Authentication Option for details).
  • Use Apache Ant to deploy the compiled application to a development environment or a production environment

Prerequisites

  1. Tomcat 6.x installed with manager app
  2. Apache Ant installed and functional: Must have access to catalina-ant.jar. This means finding catalina-ant.jar in Tomcat's lib directory, and copying it to Ant's lib. On Ubuntu, if you installed via sudo apt-get install ant tomcat6, you can probably sudo ln -s /usr/share/tomcat6/lib/catalina-ant.jar /usr/share/ant/lib/
  3. PostgreSQL database engine setup and running
  4. Database created and populated with Geoportal tables - the geoportal/etc/sql/grants_pg.sql and geoportal/etc/sql/schema_pg.sql scripts should have already been run. IMPORTANT: You can connect this geoportal deployment to an existing database that was used for another geoportal deployment only if that other geoportal deployement also used the single Administrative user, and that user has the same login as the current deployment will. You will see problems if you connect a geoportal that has a single Administrative user to a database that contains records managed by users from a different geoportal with the LDAP authentication configuration, or managed by a different Administrative user.

Installation

  • Create a new folder called 'geoportal' and copy the geoportal svn repository into a geoportal trunk checkout:https://geoportal.svn.sourceforge.net/svnroot/geoportal/Geoportal/trunk
  • Download the build_from_ant.zip file, and unzip. Drop the build_from_ant folder into the geoportal directory from the previous step.build_from_ant_copy.png
  • Make a backup copy of the \\build_from_ant\build\local.properties-example file. Then change the name of the original local.properties-example file to local.properties
  • Open local.properties and adjust the configuration options to match your environment. Notice that this file has configurations for a local and remote environment. In the file you will specify the following for each - Note, if you are only deploying in one or the other environment, you don't have to fill out the information for the environment you will not use:
    • Tomcat Access information
    • Final Geoportal webapp URL
    • Database access information
    • Lucene index locations
    • Geoportal Administrative login information
  • Save the local.properties file
  • Download the appropriate PostgreSQL JDBC driver for your installation: Download Page, and place it in \\build_from_ant\build\lib
  • Run the Ant build.xml from \\build_from_ant\build. Start by running ant clean to empty the build directory. Then, run either ant local.package or ant remote.package to compile the source code and generate the application for either a local or remote environment in the build directory.
  • Next you can run the ant war command to bundle whatever is in the build directory into a .war file, or you can bundle the war and deploy all in one step with ant local.deploy or ant remote.deploy.
  • After running the deployment command, you should see the geoportal web application running in Tomcat. If you named the geoportal web application anything besides 'geoportal', you will need to adjust the corresponding \\Tomcat\conf\Catalina\localhost context file by renaming it to match your geoportal web application name, and changing the docBase="geoportal" and path="/geoportal" values within it to also match the geoportal web application name.
Clone this wiki locally