Added by jgarnett, last edited by Martin Desruisseaux on May 04, 2006  (view change) show comment

Labels:

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

Welcome to compiling GeoAPI source code.

Compilation and Excecution Requirements

Execution (client side) Compilation (developer side)

Note: the JSR-108 dependency is automatically downloaded when building with Maven 2 (see below).

Note on covariant return types

That is otherwise known as "Type Narrowing".

Covariance is used in many places in the OpenGIS and ISO specifications, including both ISO 19107 and ISO 19111. For example, the two following interfaces are extracts from the specification:

interface CoordinateReferenceSystem { 
    public CoordinateSystem getCoordinateSystem(); 
}

interface ProjectedCRS extends CoordinateReferenceSystem { 
    public CartesianCS getCoordinateSystem(); 
}

Javadocs:

The method getCoordinateSystem(), initially defined in CoordinateReferenceSystem, is overridden in ProjectedCRS with a more restricted return type: CartesianCS, which is a subinterface of CoordinateSystem.

The specification captures the fact that, while a generic CRS may use an arbitrary CS, only CartesianCS is legal for ProjectedCRS. Such covariance is allowed at the virtual machine level, but not at the compiler level prior to 1.5. Covariance is not yet used in standard GeoAPI release for compatibility with 1.4 compiler, but may be used in future GeoAPI versions.

In the source code, methods with covariant return type are commented-out with 3 slashes (///). Those methods still commented-out at the compilation stage, but are uncommented automatically by a script before javadoc generation, for documentation purpose.

How to Compile with Maven 2

chdir geoapi/trunk/
mvn install

Maven will download a lot of files (including the JSR-108 dependency) when executed for the first time. If a download fails, just restart Maven again. If everything goes well, Maven should display "BUILD SUCCESSFUL" at the end of the build process.

How to Compile in NetBeans

Selects "New Project", "Project with existing source". In the source directory section, select <home path>/geoapi/trunk/geoapi/src/main/java. Compile and create JAR file in the usual way.

Instructions for javac users

javac -classpath units.jar -d classes <source files>
jar -cf geoapi.jar -C classes

How to Compile in Eclipse

Warning

Instructions below this point have not yet be updated for the new directory layout.

  1. Set up GeoAPI with units.jar are set as a library
    1. From the Java Persepective right click on your GeoAPI project and choose properites
    2. Select Java Build Path and switch to the Libraries tab and set up as follows:
    3. Switch to the Order and Export tab and place a check by units.jar
    4. Press Okay
  2. Set up GeoAPI Pending with dependency on GeoAPI project, and add examples as an additional src directory
    1. Right click on GeoAPI Pending project and choose properites
    2. Select Java Build Path and the Source tab and add examples as an additional source directory
    3. Switch to the Projects tab and add GeoAPI as a "required project on the build path"
    4. Press Okay

It is hoped that when we move to subversion the geoapi repository can be set up based on Maven which contains a eclipse target.