intellij.rst 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. .. _quickstart_intellij:
  2. IntelliJ QuickStart
  3. ===================
  4. .. include:: checkout.txt
  5. Import modules into IntelliJ
  6. ----------------------------
  7. #. Run the IntelliJ IDE
  8. #. From the initial panel select ``Open``.
  9. .. image:: img/intellij_open.png
  10. :width: 500
  11. #. Navigate to the ``geoserver/src/pom.xml`` directory and click ``OK``.
  12. .. image:: img/intellij_import.png
  13. :width: 350
  14. #. When asked click on ``Open as a Project``.
  15. .. image:: img/intellij_project.png
  16. :width: 350
  17. #. Optionally, depending on which platform, IntelliJ may ask to ``Trust the Project``.
  18. .. image:: img/intellij_project_trust.png
  19. :width: 350
  20. #. Wait for IntelliJ to ``Sync`` the dependencies, it's possible to follow the process from the ``Build`` tab panel on the bottom.
  21. .. image:: img/intellij_sync.png
  22. :width: 500
  23. Finalize the GeoServer Project configuration
  24. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  25. #. Click ``File > Project Structure``.
  26. .. image:: img/intellij_project_structure.png
  27. :width: 300
  28. #. Update the ``Name`` and select the correct ``SDK`` accordingly to the GeoServer version.
  29. .. image:: img/intellij_project_sdk.png
  30. :width: 400
  31. #. Click ``File > Settings``.
  32. .. image:: img/intellij_project_settings.png
  33. :width: 300
  34. #. From ``Build, Execution, Deployment > Compiler > Annotation Processors``, enable the ``Annotation processing``.
  35. .. image:: img/intellij_project_settings_annotation_processing.png
  36. :width: 600
  37. #. Click ``Build > Rebuild Project``.
  38. .. image:: img/intellij_project_rebuild.png
  39. :width: 300
  40. Run GeoServer from IntelliJ
  41. ---------------------------
  42. #. From the Project browser select the ``web-app`` module
  43. #. Navigate to the ``org.geoserver.web`` package
  44. #. Right-click the ``Start`` class and click to ``Modify Run Configuration...``
  45. .. image:: img/intellij_run.png
  46. :width: 500
  47. #. It is **important** to correctly set the ``Working directory`` to ``src/web/app``. While having the ``Edit Configurations`` dialog open, fine tune the launch environment (including setting a ``GEOSERVER_DATA_DIR`` or the ``jetty.port``). When settings are satisfactory, click ``OK``.
  48. .. image:: img/intellij_run_config.png
  49. :width: 600
  50. #. It's possible now to run GeoServer by selecting ``Run -> Run 'Start'``
  51. .. image:: img/intellij_run_start.png
  52. :width: 300
  53. Troubleshooting
  54. ^^^^^^^^^^^^^^^
  55. #. If there are errors such as "cannot find symbol class ASTAxisId", some generated code is not being included in the build. Using ``wcs1_1`` as the working directory, run a ``mvn clean install``.
  56. #. In the case of compiler errors like ``java.lang.NoSuchMethodError``, it might be due to ``Error Prone``. This tool is switched off by default, but sometimes it turns on after import to IntelliJ. There are two options to fix it:
  57. #. Go to Maven tool window and uncheck the ``errorprone`` profile, then click ``Reimport All Maven Projects``:
  58. .. image:: img/intellij_maven_errorprone.png
  59. :width: 400
  60. #. To use ``errorprone``, notably to perform the QA checks, install the ``Error Prone Compiler`` plugin, restart the IDE and set ``Javac with error-prone`` as a default compiler for the project. Please note that this will slow down the build.
  61. #. If there are errors such as "cannot find symbol AbstractUserGroupServiceTest", rebuild the ``security-tests`` project in the security module. Right-click on the ``security-tests`` project and click Rebuild.
  62. #. In the last versions of IntelliJ Annotations processors are enabled. If there are errors because of this uncheck this option from compiler settings.
  63. .. image:: img/intellij_project_settings_annotation_processing.png
  64. :width: 600
  65. #. If IntelliJ complains with an error message like ``Command line is too long.``, click on ``Shorten the command line and run.``
  66. .. image:: img/intellij_run_start_error.png
  67. :width: 300
  68. .. note::
  69. If there's a server running on localhost:8080 please check the :ref:`eclipse_guide` for instructions on changing to a different port.
  70. Run GeoServer with Extensions
  71. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  72. The above instructions assume running GeoServer without any extensions enabled. In cases where certain extensions are needed, the ``web-app`` module declares a number of profiles that will enable specific extensions when running ``Start``. To enable an extension, open the ``Maven Projects`` tool and select the profile(s) to enable.
  73. .. image:: img/intellij_run_profile.png
  74. :width: 600
  75. The full list of supported profiles can be found in ``src/web/app/pom.xml``.
  76. In order to sync the GeoServer execution with the new modules, from the ``Maven Projects`` tool click the ``Reload All Maven Project`` button (1), then ``Build the Project`` (2) and, once finished, ``Run 'Start'`` (3).
  77. .. image:: img/intellij_run_profile_sync.png
  78. :width: 400
  79. Access GeoServer front page
  80. ---------------------------
  81. * After a few seconds, GeoServer should be accessible at: `<http://localhost:8080/geoserver>`_
  82. * The default ``admin`` password is ``geoserver``.