Compiling the Java sources

From gvSIG CE Wiki

Jump to: navigation, search

Once you have completed the Eclipse set up as described in "Setting up Eclipse", you are ready to compile gvSIG CE from source.


Connecting to the SVN

The gvSIG CE source code is mananged in an SVN (Subversion) repository, hosted by

The SVN repository URL is:

  1. In Eclipse, switch to the tab "SVN Repositories".
  2. Right-click on the (perhaps empty) list of repositories on the page, or click the little "SNV+" icon at the right of the page's icon bar.
  3. In the "Add a new Repository" window that comes up, enter the repository URL above and click "Finish".

You should now find the corresponding entry in the list of connected repositories.

Checking out the source code

There are three principal directories in the SVN repository:

contains the most current version of the software. The source code here is under active development. Thus, there is no guarantee that it won't have severe bugs (even such that could cause data corruption) or will compile at all. This is the source code you want if you are interested in actively contributing to the next release of gvSIG CE. It is also what you want if you are an experienced user and want to try the latest, cutting edge developments before an official release.
is a directory that contains copies of the source code, to which substantial modifications can safely be made and tested. Use this if your work requires work on critical parts of the code, and you wish to test things first, in a separate copy of the source code.
are static snapshots of the source code. A new tag is created by copying the full source code at the time of release of a new version of gvSIG CE (including Alpha, Beta and Release Candidate versions). The purpose of these is for developers to be able to go back to any known, working version of the software, and for bug reporters to test versions prior to an official, stable release.

Let's assume you wish to actively participate in the gvSIG CE development leading up to the next release. In this case, you need to check out the version of the sources from "trunk".

In order to compile a complete version of gvSIG, you have to checkout all the subfolders in applications, extensions, frameworks and libraries into separate projects within your current Eclipse workspace. Also, check out the folder binaries as a new project. If you wish to create your own native binaries (GDAL etc.), then you also need to check out the build project folder.

If you wish to work on the project artwork (icons, splash screen, etc.), then check out the artwork folder, as well. Likewise, check out docs if you wish to work on any part of the documentation.

Finally, the support folder contains a number of additional things. You will probably at least want to download overlays, which contains a few files that need to be copied into a gvSIG CE binary distribution after compilation. There are also some extra GRASS modules to run under SEXTANTE here (grasss_sextante_bundle), and some free geographic sample datasets in sample_data. If you wish to update the EPSG database for gvSIG CE, then you also need to check out the project gt2-epsg-hsql from the support folder (see also How_to_update_the_EPSG_database).

Here's an example of how to check out one of the projects:

  1. Open the folder "applications" in "trunk". Select the folder "appCatalogAndGazetteerClient", press the right mouse button over it and choose "Checkout...".
  2. You will be presented with the "Check Out As" dialog. Per default, the option "Check out as a project in the workspace" should be activated and the "Project Name" should have been set to be identical with the name of the folder in the SVN repository. Also, make sure that "Check out HEAD revision" is marked and the "Depth" is set to "Fully recursive".
  3. If all is OK, simply press "Finish" to download the folder's contents into a new project within your Eclipse workspace.
  4. Now repeat the same for all subfolders in the other folders listed above (hint: you can select and checkout multiple folders at a time). Except for the "binaries" folder, which you must check out directly.

Check the Eclipse Console output. If there are any network errors during the process, you may have to check out again. Checking out all the sources will take a while (up to several hours for slow connections).

Checking out the OpenCAD source code

UPDATE 2015-04-11: These instructions for OpenCAD are outdated. Instead, simply check out trunk/extCAD which contains the latest version of OpenCAD plus some specific changes to fit the new gvSIG CE main GUI.

Vector layer editing support is provided by the "extCAD" extension. In gvSIG CE, the original version of this extension has been replaced with OpenCAD (

To check out the OpenCAD sources, connect with the repository at and check out "trunk". You can use regular SVN for this. By default, the source code in "trunk" will check out as "ExtCAD", so that it can be used as a straight replacement project for the old CAD editing extension (that is no longer used by gvSIG CE).

Note: Since OpenCAD lives in a different repository, its dependencies must be adjusted to match the structure of the gvSIG CE SVN repo. To do so, right-click on the "extCAD" project entry in the Eclipse Navigator. Then select "Properties". In the Properties Window, choose the "Java Build Path" entry and make sure that the following items are present:

1. In "Projects":

  • _fwAndami
  • appgvSIG
  • extJDBC
  • libDriverManager
  • libExceptions
  • libFMap
  • libGDBMS
  • libIverUtils
  • libProjection
  • libUIComponent

2. In "Libraries":

  • libFMap/lib/jts-1.12.jar
  • _fwAndami/lib/JWizardComponent.jar
  • _fwAndami/lib/log4j-1.2.8.jar
  • extCAD/lib/Smc.jar
  • extCAD/lib/xstream-1.4.4.jar
  • JRE System Library
  • JUnit 4

You may also have to adjust the "build.xml" file of OpenCAD slightly, so that it will be able to create a JAR file. Make sure that the "create-jar" target creates the "dist" and "dist/lib" folders:

 <target name="create-jar">
     <mkdir dir="${dist}"/>
     <mkdir dir="${dist}/${lib}"/>
     <jar jarfile="${dist}/lib/${jarName}" basedir="${build}"/>

Compiling the source code

In order to run gvSIG inside a Java Virtual Machine (JVM), the Java code has to be compiled to Java byte code, stored in JAR format archive files, and installed into the right application folder and subfolders.

Note that there are no makefiles to start the compilation of the source code in the individual project folders. Compilation is started automatically and in the background, whenever Eclipse detects new, uncompiled Java sources.

For this to work, make sure that auto-compilation of Java sources is turned on:

 Project -> [x] Build automatically

After a fresh check-out, the sources should be cleaned once to remove outdated compilation results:

 Project -> Clean -> (o) Clean all projects -> OK

This will kick off the compilation process.

In the Eclipse status bar, you should now see a message telling you that the sources are being compiled. If you like, you can click on it to get compilation progress window with more details.

Creating the JAR files

After compilation, the JARs need to be deployed into the right directories. This is taken care of by the ANT build files ("build.xml"), which exist in every project folder. To run the ANT build file for a project and install its JAR file, right-click it and then choose "Run As -> Ant Build".

The installation of most of the gvSIG libraries is started from the main project in "appgvSIG". Locate the ANT build file "build.xml" in there. This is the master build file which will in turn run (almost) all the ANT bulid files in the other project folders.

Before running the build process for the first time, check that it is configured correctly:

  1. Locate the "appgvSIG" folder and highlight the "build.xml" file. Right-click on it.

From the context menu, choose "Run As -> 2 Ant Build..." (i.e. the second entry, with the ellipsis (...) at the end of it).

  1. This will open the "Edit configuration" window. In the list titled "Check targets to execute:", make sure to check only the entry "build-all" and un-check all other entries. This only needs to be done once.

Then click "Run".

This will start the compilation process. The result will be displayed in Eclipse's "Console" window. If there are no errors, the process will finish with a message:

 Total time: nn seconds

The produced JAR files will automatically be copied into "_fwAndami/gvSIG/extensiones" (each extension has its individual folder there).

At this point, provided that you have a working set of native binaries (mainly for GDAL/OGR drivers), you can go straight to Running gvSIG CE to learn how to make a distribution that contains all you need to run gvSIG CE on your own system. Otherwise, learn about Setting up the GNU Compiler Collection, or continue on this page to find about further extensions for gvSIG CE.

Other projects and extensions

Some gvSIG extensions are separate projects that live in their own SVN repositories. The pages in this section provide some information on how to compile them and integrate them into a distribution of gvSIG CE


Perhaps the most important extension to gvSIG CE, SEXTANTE provides extensive geoprocessing functionality. It comes with its own collection of tools (implemented in its own Java API), as well as with interfaces for running modules of non-Java applications ("providers"), such as GRASS GIS and SAGA GIS.

Be aware that there is also a Python-based implementation of [ SEXTANTE] for use with Quantum GIS. This is not compatible with gvSIG CE!

The SEXTANTE Java sources are now kept and maintained within the gvSIG CE SVN. They can be checked out from the folder "sextante".

Read the page dedicated SEXTANTE page for more information.

3rd party extensions

IMPORTANT UPDATE Please note that the OSOR infrastructure has now been ported to the new JoinUp service. Many of the links below are now invalid. Current links can be retrieved using this URL + query string. Those extensions that were still available at the time of writing and could be compiled with the current codebase have been imported into our SVN.

extVTP (enhancement to extGraph for solving vehicle routing problem link) [This extension is now in our SVN.]

OpenCAD (enhanced version of the original extCAD: link) [This extension is now in our SVN. It has replaced the old extCAD.]

extNavTable (form-based management of attribute table data: link) [This extension is now in our SVN.]

Map Sheets (produce map series from area of interest: link)

extTOCExtra (adds some useful functions for TOC management: link) [This extension is now in our SVN]

Phone Cache (prepares tiles for gvSIG Mini: link)

extGPX (directly load GPX data: link)

gvSIGPS (manage GPS devices from within gvSIG: link)

extGeoResources (manage datasets using an integrated catalogue GUI): project page, downloads, user manual, developers manual.

Publishing Extension (create MapServer/Geoserver config files from layers): Currently, this extension exists only for gvSIG 1.1.2. An update to gvSIG 1.9/10/11 is being worked on.

Advanced Visualization Extension (side-by-side Views; download bin+src) [This extension is now in our SVN but needs compilation fixes]

GGL2 (adds a geoprocessing language: link)

GIS EIEL v2.2 (GIS used by the provincial Council of A Coruña based on gvSIG Desktop: link, gvSIG EIEL 1.0 RC2)

Space Syntax Analysis A collection of scripts for computation of basic space syntax matrics: [1]

Next steps

Should you wish to also compile your own native C/C++ support binaries (GDAL(OGR, GRASS, SAGA GIS, etc.), then continue with Setting up the GNU Compiler Collection.

Otherwise, you can go straight to Running gvSIG CE to learn how to make a distribution that contains all you need to run gvSIG CE on your own system.

Previous steps

Go back to Setting up Eclipse.