You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

Start here if you are setting up a brand new development environment, or want to reconfigure your environment from scratch.

The instructions below assume you already have available:


To set up your IntelliJ project:

  1. Launch the New Project wizard by selecting File | New | Project.

  2. In the New Project wizard, select Empty Project and click Next.

  3. Name your project "beam" and choose a location outside of the source tree, i.e. "~/IdeaProjects/beam". Don't change any other settings, and select Finish.

This will create the initial project and bring up the Project Structure settings.

  1. In the Project pane, set the Project SDK to "1.8", and select Apply.

  2. In the Modules pane, click the + and select Import Module. Select your beam repository ("~/beam") and select OK.

  3. In the Import Module wizard, select Import module from external model, then select Gradle. Then select Next.

  4. On the next screen, ensure that Create separate module per source set and Use default gradle wrapper (recommended) are selected, and keep the rest of the default values. Then select Finish.

  5. In the Problems pane, ensure there are no issues listed, then select Apply and OK.

This will close the wizard and cause IntelliJ to begin syncing project structure in the background. Continue configuring the IDE while the project syncs:

  1. Open File | Settings... In left pane, navigate to Build, Execution, Deployment | Build Tools | Gradle | Runner. Select Delegate IDE build/run actions to gradle, and Run tests using: Gradle Test Runner. Then select Apply and OK.

  2. Open View | Tool Windows | Gradle to open the Gradle pane.

Wait for the Gradle project to sync-- it may take 30 minutes or more. It should complete with no errors, and populate the list of Gradle projects in the Gradle pane.

Verify that your project is correctly configured by building and testing a single module.

You may also want to setup a specialized environment for the Beam modules you're working on:


TODO: Improve this documentation  Unable to render Jira issues macro, execution error.  


Previous documentation

The documentation below needs to be rechecked and reorganized. This is a work-in-progress.  Unable to render Jira issues macro, execution error.  

Checkstyle

IntelliJ supports checkstyle within the IDE using the Checkstyle-IDEA plugin.

Note: Older versions of IntelliJ may not support the Checkstyle file used by Beam.

  1. Install the “Checkstyle-IDEA” plugin from the IntelliJ plugin repository
  2. Configure the plugin by going to Settings -> Other Settings -> Checkstyle
  3. Set Checkstyle version to the same as in /build_rules.gradle (e.g. 8.7)
  4. Set the “Scan Scope” to “Only Java sources (including tests)”
  5. In the “Configuration File” pane, add a new configuration using the plus icon:
    1. Set the “Description” to “Beam”
    2. Select “Use a local Checkstyle file”, and point it to sdks/java/build-tools/src/main/resources/beam/checkstyle.xml within your repository
    3. Check the box for “Store relative to project location”, and click “Next”
    4. Configure the checkstyle.suppressions.file property value to suppressions.xml, and click “Next”, then “Finish”
  6. Select “Beam” as the only active configuration file, and click “Apply” and “OK”
  7. Checkstyle will now give warnings in the editor for any Checkstyle violations

You can also scan an entire module by opening the Checkstyle tools window and clicking the “Check Module” button. The scan should report no errors.

Note: Selecting “Check Project” may report some errors from the archetype modules as they are not configured for Checkstyle validation.

Code Style

Uniform formatting for Java and Groovy code is automated by the build through the Spotless Gradle plugin. Instead of relying on the IDE, now you can run ./gradlew spotlessApply to reformat changes prior to commit.

If you want to autoformat in the same way while you are developing, use the Google Java Format plugin.

Code Insight Feature Problems

  • IntelliJ can't load large files (stack overflow post):
    • In IntelliJ 2016 and higher: go to Help → Edit Custom Properties → Paste the following inside the properties file:

      #---------------------------------------------------------------------
      # Maximum file size (kilobytes) IDE should provide code assistance for.
      # The larger file is the slower its editor works and higher overall system memory requirements are
      # if code assistance is enabled. Remove this property or set to very large number if you need
      # code assistance for any files available regardless their size.
      #---------------------------------------------------------------------
      idea.max.intellisense.filesize=2500
  • IntelliJ can't recognize Python files (stack overflow post):
    • Press CTRL + ALT + SHIT + S → Go to Project Settings → Facets → expand Python → click on child → Python Interpreter
    • Project Settings → Modules → Expand module → Python → Dependencies → select Python module SDK
  • No labels