Home

Awesome

An IntelliJ plugin for Bazel projects

This project uses binary bundles licensed under JetBrains User Agreement (https://www.jetbrains.com/legal/docs/toolbox/user/).

This is an early-access version of our Bazel plugins for IntelliJ, Android Studio, and CLion.

The Bazel plugin uploaded to the JetBrains Marketplace regularly from the state of this repository. See the releases tab for more information.

Please see our latest community update for Bazel IntelliJ plugin: Announcing Bazel & JetBrains co-maintenance of IntelliJ IDEA Bazel Plugin.

Community

The Bazel project is hosting a Special Interest Group (SIG) for Bazel IntelliJ IDE plug-in. Details about the SIG and how to join the discussion can be found in the SIG charter.

Support

See the documentation entry on the plugin support across JetBrains products, languages, and operating systems.

Master branch vs Google branch

The Bazel IntelliJ plugin has two main branches (master and google).

The Bazel plugins for IntelliJ and CLion are built and released from the master branch. An external team of maintainers addresses IntelliJ and CLion plugin issues and pull requests. The Bazel plugin for Android Studio is built and released from the google branch. Internal Google teams review Android Studio plugin issues and pull requests on a case-by-case basis.

These two branches are now diverging from each other.

Installation

You can find our plugin in the JetBrains Marketplace or directly from the IDE by going to Settings -> Plugins -> Marketplace, and searching for Bazel.

Beta versions

Beta versions are usually uploaded to the Beta channel 2 weeks before they become full releases. Ways to install them:

Usage

We recommend watching this video to familiarize yourself with the plugin's features.

To import an existing Bazel project, choose Import Bazel Project, and follow the instructions in the project import wizard.

Detailed docs are available here.

Known issues

Python debugging

Please read this comment https://github.com/bazelbuild/intellij/issues/4745#issue-1668398619

Mixed Python & Java projects

In order to get correct python highlighting, please try to open "Project Structure" window and set "Python facet" there

Remote Development

To properly set up Remote Development (https://www.jetbrains.com/remote-development/), follow these steps:

  1. Create an empty project on the remote machine (this can be just an empty directory).
  2. Import the project using Remote Development.
  3. Install the Bazel Plugin on the host machine.
  4. Close the project.
  5. Open the initially intended project.

Building the plugin

Install Bazel, then build the target *:*_bazel_zip for your desired product:

from the project root. This will create a plugin zip file at bazel-bin/<PRODUCT>/<PRODUCT>_bazel.zip, which can be installed directly from the IDE. <PRODUCT> can be one of ijwb, clwb, aswb.

If the IDE refuses to load the plugin because of version issues, specify the correct ij_product. These are in the form <IDE>-oss-<VERSION> with

Note that there is a difference between intellij and intellij-ue. ue stands for IntelliJ Ultimate Edition and contains additional features for JavaScript as well as Go.

<IDE>-oss-oldest-stable and <IDE>-oss-latest-stable are aliases for the two IDE versions that the plugin is officially compatible with at a given time. <IDE>-oss-latest-stable usually maps to the last released IDE version while <IDE>-oss-oldest-stable maps to the one right before that, e.g. <IDE>-oss-oldest-stable=2022.1 and <IDE>-oss-latest-stable=2022.2. Additionally, <IDE>-oss-under-dev represents the upcoming version of the IDE that we are working towards supporting. A complete mapping of all currently defined versions can be found in intellij_platform_sdk/build_defs.bzl.

You can import the project into IntelliJ (with the Bazel plugin) via importing the ijwb/ijwb.bazelproject file.

Compatibility with IDE Versions

You can build the plugin for different IDE versions by adjusting the ij_product option either from command line or by updating the .bazelproject file to specify the desired value for ij_product under build_flags.

We have three aliases for product versions;

The current corresponding IDE versions of these aliases can be found here.

Contributions

We welcome contributions to support new IDE versions. However, to make the review process faster and easier, we recommend the following:

We may also be able to accept contributions to fix general issues or adding new features with some caveats: