GeoTools API Explore

Getting Armour code to compile using Maven

  • First, there are a couple of Java 6 javax.swing classes that this code uses (I had been using Java 5):
    • javax.swing.SwingWorker
    • javax.swing.filechooser.FileNameExtensionFilter
  • Attached Eclipse to the SVN repository found at [http://fivepoints.googlecode.com/svn] and brought down the latest revision.
  • Changed the source structure to match the standard Maven structure. This was as simple as copying the packages under the /src directory to the /src/main/java directory under the Maven project tree. (the nbproject directory wouldn't be needed for eclipse and was left intact.)
    • Brought the SVN repository into one project within Eclipse.
    • Created a new Maven Project using the simple jar archetype.
    • Ctrl-Dragged src folders from one project to the other.

Dependency Resolution

  • For those not familiar with Maven, it can automatically find, install, and add to the classpath the 3rd party libraries. You just tell it which version to use as configured in the XML file below.
  • The GeoTools library has a repository, but it isn't indexed by the Nexus indexer and for that reason isn't the easiest to work with. This page provides the details for adding the dependency for org.geotools.gt-main.
  • javax.media had a separate download and installation that happened to come with a .jar file. Not sure if the .jar is platform specific or not. I then used this maven command to install the jar:
$ mvn install:install-file -Dfile=jmf.jar -DgroupId=javax.media -DartifactId=jmf -Dversion=2.1.1e -Dpackaging=jar -DgeneratePom=true
  • com.linuxense had no pom, so it was downloaded from the creators of the package and installed using the following:
$ mvn install:install-file -Dfile=javadbf-0.4.0.jar -DgroupId=com.linuxense -DartifactId=javadbf -Dversion=0.4.0 -Dpackaging=jar -DgeneratePom=true
  • Resolved Dependencies (from the pom.xml I assembled)
  <dependencies>
    <!--
        org.geotools Repository is not Indexed; needed to find and enter
        each artifactId and version manually.
    -->
    <dependency>
        <groupId>org.geotools</groupId>
        <artifactId>gt-main</artifactId>
        <version>2.6.0</version>
    </dependency>
    <dependency>
        <groupId>org.geotools</groupId>
        <artifactId>gt-shapefile</artifactId>
        <version>2.6.0</version>
    </dependency>
    <dependency>
        <groupId>org.geotools</groupId>
        <artifactId>gt-postgis</artifactId>
        <version>2.6.0</version>
    </dependency>
    <dependency>
        <groupId>org.jgrapht</groupId>
        <artifactId>jgrapht-jdk1.5</artifactId>
        <version>0.7.3</version>
    </dependency>
    <dependency>
        <groupId>com.jhlabs</groupId>
        <artifactId>javaproj</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>net.sf.opencsv</groupId>
        <artifactId>opencsv</artifactId>
        <version>2.0.1</version>
    </dependency>
    <!--  No Maven Repository. -->
    <dependency>
        <groupId>com.linuxense</groupId>
        <artifactId>javadbf</artifactId>
        <version>0.4.0</version>
    </dependency>
    <!--
        This comes packaged as an executable that installs itself and then
        leaves a jar file in its ./lib directory (which I then installed
        locally).
    -->
    <dependency>
        <groupId>javax.media</groupId>
        <artifactId>jmf</artifactId>
        <version>2.1.1e</version>
    </dependency>
</dependencies>

Entry Point Missing

  • The code tracked in SVN doesn't have an entry point (no main routine). Not sure how the code is kicked off.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License