Changes between Version 16 and Version 17 of DevelopersGuide/CompilingUsingIntelliJ


Ignore:
Timestamp:
2020-05-25T19:43:07+02:00 (4 years ago)
Author:
simon04
Comment:

#17218 (update guide as of 2020)

Legend:

Unmodified
Added
Removed
Modified
  • DevelopersGuide/CompilingUsingIntelliJ

    v16 v17  
    33This describes how to develop and [wiki:DevelopersGuide/Compiling compile] JOSM using [https://www.jetbrains.com/idea/ IntelliJ IDEA].
    44
    5 Note that some information might be outdated due to a reorganization of the josm file tree (see #18845).
     5== Requirements ==
     6- JOSM's [[Source code]]
     7- https://www.jetbrains.com/idea/
     8- https://plugins.jetbrains.com/plugin/3612-ivyidea
    69
    7 == Getting the source code ==
     10== Guide ==
    811
    9 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`.
    10 
    11 == Configure IntelliJ (as of 2020) ==
    12 → [https://gist.github.com/simon04/08836edea15864e4b1010f960451369a setup JetBrains IntelliJ IDEA for JOSM development]
    13 
    14 == Import the project into IntelliJ ==
    15 
    16 1. Import the project into IntelliJ using the menu: `File` → `New` → `Project from Existing Sources`. Follow the wizard:
    17   1. Navigate to the folder containing the project, and select it.
    18   1. Select `Create Project from existing sources`. [[BR]] [[Image(intellij-start-from-sources (2).png, 400)]]
    19   1. Give the project a name, and click `Next`. [[BR]] [[Image(intellij-start-from-sources (3).png, 400)]]
    20   1. IntelliJ auto-detects the folders which contain source code. Click `Next`. [[BR]] [[Image(intellij-start-from-sources (4).png, 400)]]
    21   1. IntelliJ auto-detects the project libraries. Click `Next`. [[BR]] [[Image(intellij-start-from-sources (5).png, 400)]]
    22   1. IntelliJ auto-detects a number of project modules. Deselect all the modules, except the first one. Click `Next`. [[BR]] [[Image(intellij-start-from-sources (6).png, 400)]]
    23   1. Select a Java SDK, at least version 8. Click `Next`. [[BR]] [[Image(intellij-start-from-sources (7).png, 400)]]
    24   1. Deselect OSGI automatic configuration. Click `Next`. [[BR]] [[Image(intellij-start-from-sources (8).png, 400)]]
    25 == Building the project ==
    26 
    27 1. When you are prompted to add IntelliJ project configuration to Subversion, check the box `Don't ask again`, and click `Cancel`. [[BR]] [[Image(intellij-start-from-sources (9).png, 400)]]
    28 1. IntelliJ will index the project. [[BR]] [[Image(intellij-start-from-sources (10).png, 400)]]
    29 1. Open the `Ant` tool window. It contains no configuration yet. [[BR]] [[Image(intellij-start-from-sources (11).png, 400)]]
    30 1. Click the `+` button to add an Ant configuration file. Select the file `build.xml` [[BR]] [[Image(intellij-start-from-sources (12).png, 400)]]
    31 1. The Ant tool window should now list Ant tasks. [[BR]] [[Image(intellij-start-from-sources (13).png, 400)]]
    32 1. Double click the `dist` task. It will build the project. The `Messages` tool window will show the progress and logging output. [[BR]] [[Image(intellij-start-from-sources (14).png, 400)]]
    33 1. There should now be a built file: `dist/josm-custom.jar`. [[BR]] [[Image(intellij-start-from-sources (15).png, 400)]]
    34 
    35 == Running the project ==
    36 
    37 1. There are no run configurations configured. Click `Add configuration`. [[BR]] [[Image(intellij-start-from-sources (16).png, 400)]]
    38 1. Click the `+` button to add a new `JAR Application` configuration. [[BR]] [[Image(intellij-start-from-sources (17).png, 400)]]
    39 1. Give the new configuration a name. [[BR]] [[Image(intellij-start-from-sources (18).png, 400)]]
    40 1. In the field `Path to JAR`, choose the built Jar file. [[BR]] [[Image(intellij-start-from-sources (19).png, 400)]]
    41 1. Add a `Before launch` configuration item, `Run Ant target`. [[BR]] [[Image(intellij-start-from-sources (20).png, 400)]]
    42 1. A window will popup with all the available Ant tasks. Choose `dist`. [[BR]] [[Image(intellij-start-from-sources (21).png, 400)]]
    43 1. The configuration should now be ready and selected in the project. [[BR]] [[Image(intellij-start-from-sources (22).png, 400)]]
    44 1. Click the `Run` (play) button. The project should build again, and then run. [[BR]] [[Image(intellij-start-from-sources (23).png, 400)]]
    45 
    46 == Running the tests ==
    47 
    48 1. Open the `Ant` tool window. Run the `test` task. [[BR]] [[Image(intellij-test.png, 400)]]
     12- Add project from existing source
     13- Project Settings / Project: [[BR]][[Image(79651115-9491d080-81b1-11ea-9a48-99de65830f53.png, 400)]]
     14- Project Settings / Modules: [[BR]][[Image(79651289-a1aebf80-81b1-11ea-99ba-36bce549824a.png, 400)]]
     15- Project Settings / Modules: add+configure IvyIDEA [[BR]][[Image(79651643-bc813400-81b1-11ea-9f8e-c2eeb68b160c.png, 400)]] [[Image(79651825-ca36b980-81b1-11ea-9a8d-77f98fcdce8f.png, 400)]]
     16- Tools / Ivy / Resolve for All Modules: [[BR]][[Image(79653664-534df080-81b2-11ea-84bf-0bf5dbc54319.png, 400)]]
     17- Configure Ant: [[BR]][[Image(79652490-fb16ee80-81b1-11ea-844a-97628baa5075.png, 400)]]
     18- Run the following Ant tasks: [[BR]][[Image(79653168-2f8aaa80-81b2-11ea-9aee-26bfdc6fbd02.png, 400)]]
     19- Run `org.openstreetmap.josm.gui.MainApplication`: [[BR]][[Image(79653367-3d403000-81b2-11ea-968a-5760289826c8.png, 400)]]
    4920
    5021= Additional settings =
     
    6334
    6435== Search open issues ==
    65 [[Image(intellij-task-search.png)]]
     36[[Image(intellij-task-search.png, 400)]]
    6637→ Tools → Tasks & Contexts → Open Task