Skip to main content
Version: Next

Ozone Development With IntelliJ IDEA

This page covers IntelliJ IDEA setup for day-to-day work on the Ozone Java codebase: Checkstyle in the editor and fixes for common IDE problems. It complements Build with Maven, where you install JDK and Maven and run the first compile.

Before you start

  1. Clone apache/ozone and open the repository in IntelliJ IDEA.

  2. Import as a Maven project (FileOpen → select the root pom.xml or the project folder and import Maven). Wait for indexing and the first Maven import to finish.

  3. Build at least once so generated code and classes exist. From the repo root:

    mvn clean verify -DskipTests

    Shorter options, optional flags, and platform notes (for example Apple silicon) are in Build with Maven. If Build or Make fails when you follow the sections below, fix the compile first using that guide.

Work in the Ozone source repository

These steps assume you have cloned apache/ozone and opened it in IntelliJ as a Maven project. Documentation-only work on this website lives in apache/ozone-site instead.

Running SCM, OM, and datanodes from the IDE?

That workflow uses shared Run configurations in the .run folder. It is described in CONTRIBUTING.mdRun Ozone from IntelliJ (and will be covered on this site under Run → IntelliJ when that page is published).

Checkstyle in IntelliJ

Ozone enforces Java style in CI (and via checkstyle.sh). Installing the Checkstyle plugin lets you see many of the same rules before you push.

  1. Install the plugin
    Open Settings (Windows/Linux: FileSettings…; macOS: IntelliJ IDEASettings…) → PluginsMarketplace, search for CheckStyle-IDEA (sometimes listed as Checkstyle-IDEA), install it, and restart the IDE if prompted.

  2. Point the plugin at Ozone’s rules
    Open SettingsToolsCheckstyle. (On older versions the path was Other SettingsCheckstyle.)

    • Use + to add a Configuration File.
    • Description: for example Ozone.
    • File: choose hadoop-hdds/dev-support/checkstyle/checkstyle.xml inside your clone (path is relative to the repository root).
      Suppressions used in CI live next to it: suppressions.xml in the same directory—the Maven build wires that in automatically; the IDE configuration file above is the main entry point.
  3. Match the Checkstyle library version
    CI uses the version pinned in the Maven build. In your clone, open the root pom.xml and find the checkstyle.version property (for example 9.3your tree may differ after upgrades). In SettingsToolsCheckstyle, set the Checkstyle version to that same value so IDE results match mvn and checkstyle.sh.

  4. Run a scan
    Open the Checkstyle tool window, select your Ozone configuration, and run the check on the current file, module, or whole project.

The same procedure is summarized upstream in CONTRIBUTING.mdSetting up Checkstyle.

Code style and .editorconfig

Ozone also ships .editorconfig in the repo (indentation, line endings, and similar). IntelliJ can honor it when project settings are shared through Git; see JetBrains: Share IDE settings.

Common IDE problems

This section mirrors CONTRIBUTING.mdCommon problems with a bit more context for newcomers.

Generated sources (protobuf) feel “too large” for the IDE

Protobuf-generated Java can be huge. IntelliJ may stop analyzing or navigating those files and look “stuck.”

  1. HelpEdit Custom Properties…
  2. Add a line: idea.max.intellisense.filesize=10000
  3. Restart IntelliJ IDEA.

If issues remain, try FileInvalidate Caches…Invalidate and Restart after a full Maven build (mvn clean verify -DskipTests from the repo root, as in Build with Maven).

bad class file after an incremental compile

You might see an error similar to:

bad class file: hadoop-hdds/common/target/classes/org/apache/hadoop/ozone/common/ChunkBufferImplWithByteBufferList$1.class

That usually means a stale or partial compile in target/.

  1. Stop running apps/tests that use that module.
  2. Delete the offending path under target/ (or the whole module’s target directory) outside the IDE, or run mvn clean for that module / the whole tree.
  3. In IntelliJ: BuildRebuild Project.
  4. If the error persists, run mvn clean verify -DskipTests from the repository root, then FileReload All Maven Projects.

See also