bazelbuild / intellij

IntelliJ plugin for Bazel projects
https://ij.bazel.build/
Apache License 2.0
757 stars 298 forks source link

Bazel build error while syncing Go Lang Project #6430

Closed satyanandak closed 2 months ago

satyanandak commented 2 months ago

Description of the bug:

encountered with below error while syncing Go Lang Project

Warning:Sync was successful, but there were Bazel build errors. The project may not be fully updated or resolve until fixed. If the errors are from your working set, please uncheck 'Bazel > Sync > Expand Sync to Working Set' and try again.

Error:Traceback (most recent call last): Error:at /usr/local/google/home/satyanandak/.cache/bazel/_bazel_satyanandak/0c8b9711e56348ba5d1f2e0a2fb93b15/external/intellij_aspect/intellij_info_bundled.bzl:4:5: initialization of module 'intellij_info_impl_bundled.bzl' failed Error:(4, 5) initialization of module 'intellij_info_impl_bundled.bzl' failed Error:command succeeded, but not all targets were analyzed Error:Build did NOT complete successfully

Which category does this issue belong to?

No response

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

1> Open the IDE after installing the Bazel plugin you built 2> Select “Import Bazel Project”
3> Select v20YY.MM.DD/intellij/examples/go/with_proto as your workspace then click Next 4> Select “Import Project View File” and point it to v20YY.MM.DD/intellij/examples/go/with_proto/with_proto.bazelproject then click Next. 5> then click Create.

Which Intellij IDE are you using? Please provide the specific version.

IntelliJ IDEA 2023.3.6 RC & 2024.1.2

What programming languages and tools are you using? Please provide specific versions.

No response

What Bazel plugin version are you using?

2024.05.07.0.1-api-version-233 & 2024.05.07.0.1-api-version-241

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

image

mai93 commented 2 months ago

fixed with 70d518c669857af5c3bc37533e204362b8ce2245, I cherry picked it to the beta release of IJ and CL

aira-xite commented 1 month ago

@mai93 still happens for me on IntelliJ IDEA 2024.1.2 (Ultimate Edition), Build #IU-241.17011.79, built on May 22, 2024 and com.google.idea.bazel.ijwb (2024.05.21.0.1-api-version-241) which is the latest beta version available.

I tried:

Complains about this

ERROR: Traceback (most recent call last):
    File "...../external/intellij_aspect/intellij_info_impl_bundled.bzl", line 3, column 37, in <toplevel>
        load("@rules_java//java:defs.bzl", "JavaInfo", "java_common")
Error: file '@rules_java//java:defs.bzl' does not contain symbol 'JavaInfo'
mai93 commented 1 month ago

@aira-xite as release notes recommends (https://github.com/bazelbuild/intellij/releases/tag/v2024.05.21-rc-1), you need to have rules_java of version to 5.3.5 or later

aira-xite commented 1 month ago

Okay, it works now. Apparently, even the latest v6.5.0 of rules_scala transitively fetches v4.1.0 of rules_java. I don't know exactly how this is happening because the rules_scala repository defines version 5.4.1, but I see that load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config") causes rules_java v4.1.0 to be loaded. So solution is to explicitly define rules_java 5.3.5+ before defining rules_scala.