wiki:DevelopersGuide/CompilingUsingIntelliJ

Version 16 (modified by simon04, 4 years ago) ( diff )

#17218 (update guide as of 2020)

Compiling using ​IntelliJ IDEA

This describes how to develop and compile JOSM using IntelliJ IDEA.

Note that some information might be outdated due to a reorganization of the josm file tree (see #18845).

Getting the source code

  1. Follow the steps in Source code#Getthesource to get the source code from Subversion. For this guide, assume it is located in a folder josm-svn.

Configure IntelliJ (as of 2020)

setup JetBrains IntelliJ IDEA for JOSM development

Import the project into IntelliJ

  1. Import the project into IntelliJ using the menu: FileNewProject from Existing Sources. Follow the wizard:
    1. Navigate to the folder containing the project, and select it.
    2. Select Create Project from existing sources.
    3. Give the project a name, and click Next.
    4. IntelliJ auto-detects the folders which contain source code. Click Next.
    5. IntelliJ auto-detects the project libraries. Click Next.
    6. IntelliJ auto-detects a number of project modules. Deselect all the modules, except the first one. Click Next.
    7. Select a Java SDK, at least version 8. Click Next.
    8. Deselect OSGI automatic configuration. Click Next.

Building the project

  1. When you are prompted to add IntelliJ project configuration to Subversion, check the box Don't ask again, and click Cancel.
  2. IntelliJ will index the project.
  3. Open the Ant tool window. It contains no configuration yet.
  4. Click the + button to add an Ant configuration file. Select the file build.xml
  5. The Ant tool window should now list Ant tasks.
  6. Double click the dist task. It will build the project. The Messages tool window will show the progress and logging output.
  7. There should now be a built file: dist/josm-custom.jar.

Running the project

  1. There are no run configurations configured. Click Add configuration.
  2. Click the + button to add a new JAR Application configuration.
  3. Give the new configuration a name.
  4. In the field Path to JAR, choose the built Jar file.
  5. Add a Before launch configuration item, Run Ant target.
  6. A window will popup with all the available Ant tasks. Choose dist.
  7. The configuration should now be ready and selected in the project.
  8. Click the Run (play) button. The project should build again, and then run.

Running the tests

  1. Open the Ant tool window. Run the test task.

Additional settings

This section describes helpful additional settings for IntelliJ IDEA.

Link ticket references in commit messages

Make ticket references in the code of the form ticket 1234 or #1234 clickable as a link to the Trac ticket.

  1. Open the Issue Navigation settings page.
  2. Add a new Issue Navigation item, with:
    • Issue ID: (ticket\s*|#)(\d+)
    • Issue link: https://josm.openstreetmap.de/ticket/$2

Search open issues

→ Tools → Tasks & Contexts → Open Task

Attachments (44)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.