Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IntelliJ doesn't pick up proto annotations dependency #383

Open
johanandren opened this issue Sep 14, 2021 · 8 comments
Open

IntelliJ doesn't pick up proto annotations dependency #383

johanandren opened this issue Sep 14, 2021 · 8 comments
Labels
DX Developer Experience related issue java-sdk-protobuf kalix-runtime Runtime and SDKs sub-team

Comments

@johanandren
Copy link
Contributor

Importing and build a fresh project from the maven archetype in IntelliJ (v 212.4746.92 with bundled protobuf
plugin version) still marks the protobuf dependencies as unknown/red. Is there something we are missing doing or is it a shortcoming of the protobuf plugin (seems like plugin docs says you need to add non source protobuf paths manually https://github.com/jvolkman/intellij-protobuf-editor#path-settings)?

Screenshot 2021-09-14 at 10 37 14

Screenshot 2021-09-14 at 10 41 22

@johanandren
Copy link
Contributor Author

Related upstream issue in protobuf editor plugin: jvolkman/intellij-protobuf-editor#30

@johanandren
Copy link
Contributor Author

Issue now in the IntelliJ tracker rather than that repo: https://youtrack.jetbrains.com/issue/IDEA-280610

@ennru ennru added kalix-runtime Runtime and SDKs sub-team DX Developer Experience related issue labels Apr 21, 2022
@ennru
Copy link
Member

ennru commented Apr 21, 2022

Even the generated sources directories are not always picked up correctly.

@johanandren
Copy link
Contributor Author

Splitted out the source directories to a separate task as it is not quite the same.

Not entirely sure we can do anything here, would need a fix/change in the IntelliJ protobuf plugin.

@ennru
Copy link
Member

ennru commented Apr 25, 2022

Some hint came in on this:

The only way I could see to get Intellij to recognize the proto files is by using the Path Settings. This works well for proto files included in the project, but it didn't seem to work when proto files were provided in a jar as a dependency. Such as with the Kalix protocol.

You'll notice by default when you open the path settings, there'll be some references/entries to the projects src, and the last entry is for the default provided google proto files located in the following location, at least for mac..

/Users/username/Library/Caches/JetBrains/IntelliJIdea2022.1/protoeditor
As "hacky" as it is, what I found to work is unzipping the Kalix protocol jar, and grabbing the Kalix and Google API proto files, and copying them to this "protoeditor" directory. Once I did that, the editor was able to recognize them.

This basically resolved the editor not being able to pick up the dependencies, however even without that, the project would still build and compile without issue. So this little hack just helps the editor find the right dependencies.

I tried different variations of trying to directly reference the jar in the path settings for the protobuf plugin, but nothing else seemed to work. So manually copying the proto files to the protoeditor directory seemed to work.

@johanandren
Copy link
Contributor Author

Trying out the hint in this comment: jvolkman/intellij-protobuf-editor#64 (comment) adding a random directory, then editing the path in the IntelliJ protobuf path list to be jar:///Users/johan/.m2/repository/io/kalix/kalix-sdk-protocol/1.0.0-M2/kalix-sdk-protocol-1.0.0-M2.jar!/ works (but it's quite a nuisance so not really a reasonable workaround imo)

@johanandren
Copy link
Contributor Author

Tried out the third party Protobuf plugin from https://github.com/devkanro/intellij-protobuf-plugin/releases/tag/v1.5.20

It seems to work very nicely, picking up the right messages and annotations from jar dependencies both in a sample maven project and a sample scala/sbt project.

Installing it requires disabling the default plugins for Protobuf and gRPC shipped with IntelliJ first, so that is a bit cumbersome.

@raboof raboof changed the title IntelliJ doesn't pick up annotations dependency IntelliJ doesn't pick up proto annotations dependency May 30, 2022
@johanandren
Copy link
Contributor Author

Since I forgot this already once: Note that this does work as expected for the Scala SDK already, only the Java SDK with maven has the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX Developer Experience related issue java-sdk-protobuf kalix-runtime Runtime and SDKs sub-team
Projects
None yet
Development

No branches or pull requests

2 participants