Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why I cannot import JsonFormat from package com.google.protobuf.util?

Currently, I'm working on google cloud (google pub/sub). I've used java client. But I cannot import JsonFormat class from package com.google.protobuf.util. I'm using intelliJ idea, I have tried invalidate cache and restart the idea. What am I missing?

  • My build.gradle
    // google cloud
    implementation platform('com.google.cloud:libraries-bom:22.0.0')

    implementation 'com.google.cloud:google-cloud-pubsub'
  • the artifact had been imported
like image 817
Blind Avatar asked Oct 12 '25 10:10

Blind


1 Answers

In latest versions of google cloud bom the package com.google.cloud.protobuf:protobuf-util is used with runtime scope, so it's not available during compilation. Not sure why they changed it... Adding manually the dependency with compile scope (maven) or implementation (gradle) should help.

Source: https://mvnrepository.com/artifact/com.google.cloud/google-cloud-pubsub/1.114.7

like image 148
Нико Тсиукарис Avatar answered Oct 13 '25 22:10

Нико Тсиукарис



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!