Eclipse: Set up project and example extension from git sources

From OpenJUMP Wiki
Jump to navigation Jump to search

Download and install eclipse (if not already available)

Download and unzip from
https://www.eclipse.org/downloads/packages/
either
Package for Enterprise Java and Web Developers
Package for Java Developers
each will do fine for OJ development

All the below was tested with eclipse version 2024.06.

OpenJUMP project

Import into eclipse IDE

NOTE: The file system paths below are for windows but can analogous be some unix/linux/mac paths.

  1. Start the eclipse application
  2. Create and open a new workspace e.g. C:\workspace-OpenJUMP
  3. File > Import...
    1. Git > Projects from Git (with smart import) ; Next>
    2. Clone URI ; Next>
    3. enter URI https://github.com/openjump-gis/openjump.git ; Next>
    4. make sure at least branch main is selected ; Next>
    5. choose a location for the project folder e.g. C:\workspace-OpenJUMP\OpenJUMP ; Next>
    6. eclipse will now clone the git repository into the project folder
  4. Import Projects dialog pops up
    1. Folder OpenJUMP should be preselected Import as Maven
    2. Finish>

eclipse should now build the maven project without errors (warnings can be ignored)

Create run/debug configuration

When the project builds fine you will need to provide some information to be able to run OJ directly from the built project.

  1. Run > Run Configurations...
    1. Right click Java Application on the left side ; Select New Configuration
    2. change Name above tabs from
      New Configuration
      to
      OpenJUMP
    3. tab Main
      1. make sure Project is
        OpenJUMP
      2. add Main Class
        com.vividsolutions.jump.workbench.JUMPWorkbench
    4. tab Arguments
      1. add Program arguments
        -default-plugins scripts\default-plugins.xml -extensions-directory "lib\ext" -extensions-directory "target\lib.ext.core" -extensions-directory "target\lib.ext.plus" -I18n en_US -v info
        NOTE: you can
        change the language/region with the parameter -I18n or
        raise the log verbosity to debug with -v or
        remove -extensions-directory "target\lib.ext.plus" to simulate OJ CORE
      2. add VM arguments
        -Djava.system.class.loader=com.vividsolutions.jump.workbench.plugin.PlugInClassLoader
    5. save configuration with button Apply (bottom right)
    6. run configuration with button Run (bottom right)

eclipse should now start OJ and be able to do so in the future. you can also debug OJ by selecting the created run configuration under Run > Debug Configurations... .
there are also handy buttons on the toolbar available to do so quickly. note the small downward arrows beside them!


HelloWorld extension

OJ extension projects usually are managed/build by maven. Extensions bundle/initialize/install plugins. Here's a quick explanation.

Maven also packages them into self contained distribution jar files that can be placed under 'lib/ext/' in your OJ installation to be used. In case the extension needs additional (not-jar) files the distribution is done as zip file containing jars and files/folder to be placed under 'lib/ext/'.

Import project

generally you repeat all steps from Import OJ into eclipse above. but this time use

  1. URI https://github.com/openjump-gis/openjump.git
  2. project name HelloWorld-Extension

let the import finish and build.

Create run/debug configuration