Added by jgarnett, last edited by jgarnett on Oct 13, 2008  (view change)

Labels:

Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.

Several GeoTools modules depend on other GeoTools modules, so the first thing you will want to do is perform a full build so that you have a jar from each module installed in your local repository.

Building With Maven

  1. Let's start by going to where you have the source code.
    • cd C:\java\geotools\trunk
  2. And check that we actually have the source code
    C:\java\geotools\trunk>dir
     Volume in drive C is INTERNAL
     Volume Serial Number is 3CA5-71DD
    
     Directory of C:\java\geotools\trunk
    
    26/04/2007  11:12 AM    <DIR>          .
    26/04/2007  11:12 AM    <DIR>          ..
    11/01/2007  12:25 AM    <DIR>          build
    01/12/2006  01:27 AM    <DIR>          demo
    04/11/2006  01:04 PM    <DIR>          doc
    16/07/2006  07:56 AM    <DIR>          licenses
    07/04/2007  10:36 AM    <DIR>          modules
    26/04/2007  11:12 AM            52,450 pom.xml
    22/10/2006  09:11 AM             3,705 README.txt
    26/04/2007  10:08 AM    <DIR>          target
                   2 File(s)         56,155 bytes
                   8 Dir(s)  15,264,776,192 bytes free
    
  3. Make sure you are connected to the internet
  4. Let's try your first build
    C:\java\geotools\trunk>mvn install
    
  5. If all is well, Maven should download the required .jar files and build GeoTools modules. At the end of this process it will display a list of all the modules which were built and installed correctly.
    ... BUILD SUCCESS
    

The first build takes a while due to the download time for the .jar files.

Future builds check for the most recent .jar files from the internet. The checking is based of md5 checksums and does not take long.

Really Building All Modules

GeoTools plays host to a number of experiment "unsupported" modules; if you would like to help out on any of these modules (or get a preview of new features).

mvn install -Dall

The "-Dall" acts as a switch to part engages several profiles; you can also do this by hand with -P

  modules that are included -Dall
-Pgdal include modules that depend on having gdal installed into your JRE
-Ppending several experimental modules
-Praster  
-Pswing  
-Pworkflow process and wps support
  Not included with -Dall
-Parchive modules that no longer work

Building Offline

However when working offline, you can bypass the checking of md5 files and run maven using the following:

C:\java\geotools\trunk>mvn -o install

This will save a bit of time....

Configuring the heap size

The Maven build may requires a fair amount of memory. For example some JUnit tests are known to fail on Maven 2 whith the default heap size. The maximal heap size need to be increased, and may be configured as below (on Windows command line):

set MAVEN_OPTS=-Xmx384M

Configuring a proxy server

If you are behind a firewall, you will need maven to use a proxy server.

The above link shows how modify the settings.xml file in your .m2 directory.

BUILD FAILURE!

Or if something went wrong you will get feedback like this:

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7 minutes 56 seconds
[INFO] Finished at: Mon Nov 20 12:15:48 PST 2006
[INFO] Final Memory: 23M/42M
[INFO] ------------------------------------------------------------------------

You need to scan back through the output and find the "<<< FAILURE!"

Running org.geotools.data.mif.MIFDataStoreTest
Tests run: 9, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 6.703 sec <<< FAILURE!

Common Build Problems

The following common problems occur during a:

mvn -U clean install

Failure of Metadata RangeSetTest

This looks like the following:

[INFO] ----------------------------------------------------------------------------
[INFO] Building Metadata
[INFO]    task-segment: [clean, install]
[INFO] ----------------------------------------------------------------------------
[INFO] [clean:clean]
...
Running org.geotools.util.RangeSetTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.031 sec <<< FAILURE!

Navigating into the directory to look at the actual error:

C:\java\geotools\trunk\modules\library\metadata\target\surefire-reports>more *RangeSetTest.txt
-------------------------------------------------------------------------------
Test set: org.geotools.util.RangeSetTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.031 sec <<< FAILURE!
testRangeRemoval(org.geotools.util.RangeSetTest)  Time elapsed: 0 sec  <<< ERROR!
java.lang.NoClassDefFoundError: javax/media/jai/util/Range
        at org.geotools.util.RangeSetTest.testRangeRemoval(RangeSetTest.java:58)

This indicates that Java Advanced Imaging has not been installed into the JRE (please see the dependencies section and try again).

Experimental Option

On GeoTools trunk you can try the following experimental option:

mvn install -Pnojai

This will download and use just the JAI jar files, you wont get native performance - but for a build do you even care?

Failure of GridCoverageRendererTest

This looks like the following:

[INFO] ----------------------------------------------------------------------------
[INFO] Building Render
[INFO]    task-segment: [install]
[INFO] ----------------------------------------------------------------------------
...
Running org.geotools.renderer.lite.GridCoverageRendererTest
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.062 sec <<< FAILURE!

Details:

C:\java\geotools\trunk\modules\library\render\target\surefire-reports>more *GridCoverageRendererTest.txt
-------------------------------------------------------------------------------
Test set: org.geotools.renderer.lite.GridCoverageRendererTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.062 sec <<< FAILURE!
testPaint(org.geotools.renderer.lite.GridCoverageRendererTest)  Time elapsed: 0.047 sec  <<< ERROR!
java.lang.NullPointerException
        at org.geotools.renderer.lite.GridCoverageRendererTest.getGC(GridCoverageRendererTest.java:103)
        at org.geotools.renderer.lite.GridCoverageRendererTest.testPaint(GridCoverageRendererTest.java:163)

testReproject(org.geotools.renderer.lite.GridCoverageRendererTest)  Time elapsed: 0 sec  <<< ERROR!
java.lang.NullPointerException
        at org.geotools.renderer.lite.GridCoverageRendererTest.getGC(GridCoverageRendererTest.java:103)
        at org.geotools.renderer.lite.GridCoverageRendererTest.testReproject(GridCoverageRendererTest.java:199)

This indicates that Image IO support has not been installed into the JRE (please see the dependencies section and try again).

Failure of Rendering2DTest

This looks like the following:

Running org.geotools.renderer.lite.Rendering2DTest
Feb 25, 2008 11:46:05 AM org.geotools.renderer.lite.Rendering2DTest testScaleCalc
INFO: 109047.25511429817
Tests run: 14, Failures: 0, Errors: 11, Skipped: 0, Time elapsed: 1.469 sec <<< FAILURE!

This can be caused when a build is performed on Linux (*nix) and a frame buffer is not available. It can be rectified
by running Java in headless mode:

export MAVEN_OPTS="-Djava.awt.headless=true"

If this doesn't work you can always try:

  • running a virtual frame buffer on the build machine:
    Xvfb :1 &; export DISPLAY=:1
  • running an X11 server on the build machine and doing a local GUI login
  • running an X11 server on a remote machine, using ssh with X11 forwarding to login to the build machine