# Bazel project view

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com.cn/en-us/help/idea/2026.3/llms.txt).

A Bazel project view is a configuration used by IntelliJ IDEA to:

* Decide which parts of a Bazel workspace to import/index

* Decide which Bazel targets to sync for features, such as code navigation, completion, run configurations, and tests

* Apply Bazel flags and other settings to the sync and build actions initiated from IntelliJ IDEA.

Bazel project view prevents pulling the entire Bazel workspace when you only need one or several subtrees. It does not change the way Bazel works, but rather scopes the work Bazel and IntelliJ IDEA do. This improves the performance and makes the project easier to work with.

## Project view configuration

The project view is configured in a `.bazelproject` file. You might have several such files located anywhere in your project. For information on file syntax, refer to [.bazelproject file reference](bazelproject-reference.html).

> **Tip:**
> If your teammates are working on the same subset of the project, you can create a `.bazelproject` file and [share it through VCS](version-control-integration.html). This will ensure a consistent view of the project for everyone.

## Navigate to the current project view

If you are unsure where the currently active project view is configured, the IDE can bring you to the corresponding file.

Procedure:

1. In the right sidebar, click the Bazel icon. Alternatively, select `View | Tool Windows | Bazel` from the main menu.

![Bazel tool window icon on the right sidebar](https://resources.jetbrains.com.cn/help/img/idea/2026.3/bazel-tw-icon.png)

2. Click the Open project view file in editor button.

!['Open project view file in editor' button in the Bazel tool window](https://resources.jetbrains.com.cn/help/img/idea/2026.3/bazel-open-project-view.png)

## Select a project view

When there are multiple project views in a workspace, you can switch between them.

Procedure:

* From the Project tool window: right-click a `.bazelproject` file and select Load Project View.

* From settings `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)): go to `Build, Execution, Deployment | Build Tools | Bazel`, then enter the path to the `.bazelproject` file in the Project View Path field.

## .managed.bazelproject

There is a special type of .bazelproject file that is checked into your repo and owned by repo maintainers. To define a central template, place it in `tools/intellij/.managed.bazelproject`. It is used to provide a default minimal view for scenarios such as large repos and short-lived remote development environments.

Here is a short summary of the differences between the two types of project views:

|  | `.managed.bazelproject` | `.bazelproject` |
| --- | --- | --- |
| Purpose | A canonical, centrally maintained project view template for your organization/repo. | The concrete project view that IntelliJ IDEA actually reads when indexing/building.  |
| Location | Under your repo, typically at `tools/intellij/.managed.bazelproject` | Generated inside your checkout at `.bazelbsp/.bazelproject` |
| Ownership | Maintained by the repo (code owners, build team). | Per-user, per-working-copy artifact created by the plugin. |
| VCS | Committed to VCS. | Usually NOT committed; treated as a generated file. |
| Intended edits | You generally do not edit this locally unless you are changing the shared template for everyone . | You can make local tweaks here, but they are not shared with others. |

When you open a new project that has a `.managed.bazelproject` file, IntelliJ IDEA will generate a `.bazelproject` file based on it.

The precedence order for project view resolution is:

* `{project root}/.bazelproject`

* `managed.bazelproject` is copied to `{project root}/.bazelbsp/.bazelproject` – configurable via `Settings | Build, Execution, Deployment | Build Tools | Bazel`

* default `{project root}/bazelbsp/.bazelproject` is created with the following settings: ``` derive_targets_from_directories: true directories: . ```

