I have been scratching my head on this one for a couple of hours so sharing the steps here;
-
Install bazel plugin
-
Set executable home in ‘Other Settings’ to Bazel installation (for me this was in /usr/local/Cellar/bazel)
-
To enable Bazel with Go in Intellij (for existing projects), update your .idea/workspace.xml to use;
<component name="BlazeImportSettings">
<option name="buildSystem" value="Bazel" />
<option name="projectDataDirectory" value="$PROJECT_DIR$" />
<option name="projectName" value="" />
<option name="projectViewFile" value="$PROJECT_DIR$/.bazelproject" />
<option name="workspaceRoot" value="$PROJECT_DIR$" />
</component>
Above the ‘changelistmanager’ component.
- This possibly also requires your .bazelproject be configured. Seems to be limited documentation on this file but it is the file that tells the bazel plugin what to ‘see’ in your project.
directories:
.
targets:
//...:all
additional_languages:
# Uncomment any additional languages you want supported
# android
# dart
go
# javascript
# python
# scala
# typescript