MapStore Training

Previous topic

MapStore dependencies

Next topic

Manage Build Configuration

This Page

MapStore Build fileΒΆ

This section illustrates the functionality of MapStore Build file.

Note

To initialize, build and to run the application you need Ant and Maven. In addition, to pull in external dependencies, you’ll need Git installed. Before running in development mode or preparing the application for deployment, you need to pull in external dependencies.

The MapStore build file is a file called build.xml and placed in the root directory of MapStore.

Moved to the root directory of MapStore:

you@prompt:~$ cd mapstore/
 ../mapstore/
     externals
     installer
     lib
     mapcomposer
     mapmanager
     release
     .gitignore
     build.xml
     createGitIgnore
     license.txt
     license_top.txt
     README.md

Once inside the root you can run ant command with several targets.

Some of them are:

  1. ant init
you@prompt:~/mapstore$ ant init

To download RingoJs dependencies from remote Geosolutions maven repository (this is the first target to run)

<target name="init" depends="checkringo" unless="ringo">
    <echo message="downloading RingoJS jars"/>
    <artifact:remoteRepository id="remote.repository" url="http://maven.geo-solutions.it" />
    <artifact:dependencies filesetId="dependency.fileset" useScope="test">
      <remoteRepository refid="remote.repository" />
      <dependency groupId="org.ringojs" artifactId="ringojs" version="0.7.0-geosolutions"/>
      <dependency groupId="org.ringojs" artifactId="ringojs-run" version="0.7.0-geosolutions"/>
    </artifact:dependencies>
    <copy todir="${ringojs.dir}/lib">
      <fileset refid="dependency.fileset" />
      <!-- This mapper strips off all leading directory information -->
      <mapper type="flatten" />
    </copy>
</target>
  1. ant debug
you@prompt:~/mapstore$ ant debug

To run MapComposer application in development mode. In development mode, individual scripts are available to a debugger.

If the build succeeds, you’ll be able to browse to the application at http://localhost:8081/. By default, the application runs on port 8081. To change this, you can set the app.port property as follows (setting the port to 9080):

you@prompt:~/mapstore$ ant -Dapp.port=9080 debug
  1. ant dist
you@prompt:~/mapstore$ ant dist

The MapStore application can be run in distribution mode. In distribution mode, scripts are concatenated and minified. The dist target will result in a directory that can be dropped in a servlet container like Apache Tomcat.

After the build you will have two new directories created:

../mapstore/mapcomposer/build/mapcomposer
../mapstore/mapmanager/build/mapstore

To deploy your MapStore move the built ‘mapstore’ and ‘mapcomposer’ directories to your servlet container.

  1. ant war
you@prompt:~/mapstore$ ant war

Generate the web archive file, a file with .war extention.

../mapstore/mapcomposer/build/mapcomposer.war
../mapstore/mapmanager/build/mapstore.war

This file can be dropped in a servlet container like Apache Tomcat.

  1. ant clean
you@prompt:~/mapstore$ ant clean

Remove all previous build