For IntelliJ 2023.3 and newer, make sure you have DevKit plugin installed in your host IntelliJ.
https://plugins.jetbrains.com/plugin/22851-plugin-devkit
Clone and import this repository as you would any other Bazel project.
When asked, use the bundled project view file (ijwb/ijwb.bazelproject
). This will:
- Set the plugin to build with the latest development version by default.
- Automatically import the relevant target, and exclude the irrelevant ones.
Depending on which JetBrains product you're targeting, you may want to adjust the --define
flag in the build_flags
section. For more information on which values you can pass, please refer to Building the Plugin
Most of the time, the IntelliJ Platform Plugin SDK bundled with your IntelliJ installation should be enough to compile and run the plugin.
To install it, please head to the SDK menu (Cmd+;
or Ctrl+;
), and then to Platform Settings -> SDKs
.
In the list of SDKs, press the +
icon, then Add IntelliJ Platform Plugin SDK
.
![image](https://private-user-images.githubusercontent.com/326857/267739735-d5323a70-d93b-4734-a64c-d8018e19adc1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU5OTY3MjMsIm5iZiI6MTcyNTk5NjQyMywicGF0aCI6Ii8zMjY4NTcvMjY3NzM5NzM1LWQ1MzIzYTcwLWQ5M2ItNDczNC1hNjRjLWQ4MDE4ZTE5YWRjMS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkxMFQxOTI3MDNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT05N2Q5Njc4NjJhMzBlMmY5NDlkMDA4ZTNmOGIyZWVhNTExNzg4MzMyMjQzNDExZGQ3NzQwYTNmMzZkYWZhMDk4JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.8aMaoCQupepph-TZWpRMWGJe8Eb-B-Q7duCAXrJDNgI)
A file explorer window should open in the Contents
directory of your IntelliJ installation. Select that directory.
![image](https://private-user-images.githubusercontent.com/326857/267739637-ce7b591f-ca51-42e5-8038-07f2a102a700.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU5OTY3MjMsIm5iZiI6MTcyNTk5NjQyMywicGF0aCI6Ii8zMjY4NTcvMjY3NzM5NjM3LWNlN2I1OTFmLWNhNTEtNDJlNS04MDM4LTA3ZjJhMTAyYTcwMC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkxMFQxOTI3MDNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0yN2E0MWI4ZGM0ODIwMjg1OTIzYTJiYzU1ZmIyNjFkMWEzNTMyMzQ5MjU2NzZlOTc0MjE2Njk1Mjk2M2NkNTJhJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.WQFRWrKqYvD-rGyfbU4u9376laK-Nr3buMVp0lUKUcE)
Make sure that the Internal Java Platform
is set to the JDK you want to use to develop your plugin. It is recommended to use JBR 17.
![image](https://private-user-images.githubusercontent.com/326857/271356392-28f05554-a4d8-43f4-b2bb-b971a7ee6da7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU5OTY3MjMsIm5iZiI6MTcyNTk5NjQyMywicGF0aCI6Ii8zMjY4NTcvMjcxMzU2MzkyLTI4ZjA1NTU0LWE0ZDgtNDNmNC1iMmJiLWI5NzFhN2VlNmRhNy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkxMFQxOTI3MDNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1iNGQ1NjdjOWUwNzQzMWNmYzY1YmE1ZjExYTFiNzE4Yjc0YTAxMjI0MWQyYmI1YzhjOTlmNjQ0YmQxZDY5OGM0JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.oXRB8CDAwwmDUrjoU9p33kOq6Hili-AyNoO4_rWHV5U)
Inside IntelliJ, go to the SDK menu (Cmd+;
or Ctrl+;
).
Go to Project
, and look under SDK
to find the JetBrains Runtime SDK installed in the previous step.
![image](https://private-user-images.githubusercontent.com/326857/267750330-356b1d93-b9a5-4366-9ed4-6b0a967d3fee.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU5OTY3MjMsIm5iZiI6MTcyNTk5NjQyMywicGF0aCI6Ii8zMjY4NTcvMjY3NzUwMzMwLTM1NmIxZDkzLWI5YTUtNDM2Ni05ZWQ0LTZiMGE5NjdkM2ZlZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkxMFQxOTI3MDNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1jOWExNmI0Njg4MTY4ODM5NTUxOWMzZTZiZjljMzI2YzNhMWQwYzg0MDE5YzY0YTQ1MzFhZDk3YjFjNzhjNWNmJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.eMdIBVILrwsNbWmnivYvhgqcmv2viqEBALsVx9KC7U8)
Once the project is imported, create a new Run configuration: Run -> Edit Configurations...
.
Click the +
sign, and create a new Bazel IntelliJ Plugin
run configuration (the Bazel IntelliJ plugin needs to be installed):
![image](https://private-user-images.githubusercontent.com/326857/267748669-b1710978-437f-47ee-a490-ea0d1ab39985.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU5OTY3MjMsIm5iZiI6MTcyNTk5NjQyMywicGF0aCI6Ii8zMjY4NTcvMjY3NzQ4NjY5LWIxNzEwOTc4LTQzN2YtNDdlZS1hNDkwLWVhMGQxYWIzOTk4NS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkxMFQxOTI3MDNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1lN2QzMjU5ZGIxM2QzMmI0Nzg5YjE2NTA1Yzc0NWYwM2Q4MzE0NzU0OWQ1ZmYxZDZkYmZhNzYyOGRhZjdjN2RmJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.UU4h7TCXbTFLKz_6lix0WXVoqoGiDQZ5k3i_BYgiWOk)
Configure the Plugin SDK
field to use the SDK you've just installed.
![image](https://private-user-images.githubusercontent.com/326857/267749249-92e107d3-e9f6-479c-a127-4f4202b21f41.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU5OTY3MjMsIm5iZiI6MTcyNTk5NjQyMywicGF0aCI6Ii8zMjY4NTcvMjY3NzQ5MjQ5LTkyZTEwN2QzLWU5ZjYtNDc5Yy1hMTI3LTRmNDIwMmIyMWY0MS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTEwJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkxMFQxOTI3MDNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1mNWM4NWZhMzU1ZmMxOTI5ODFkYjAxOTMwYThlNDMyNDYyMzMwMWI0OGIxN2YwMTk1ZWJmNzE1NjMyNWM3YzNiJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.ONNMiY29ycv4ktJsz35SSO3M8M5F3zaQ8iZyNiXOszM)