I'm trying to use the Google Cloud Storage SDK for Java into my Spring application.
Using Maven I've added it to my dependencies:
<dependency> <groupId>com.google.cloud</groupId> <artifactId>google-cloud-storage</artifactId> <version>1.31.0</version> </dependency>
Then I try to initialize the Storage client with:
client = StorageOptions.newBuilder() .setCredentials(ServiceAccountCredentials.fromStream(new ClassPathResource("/my/path/to.json").getInputStream())) .build() .getService();
but an error occurs
java.lang.NoSuchMethodError: com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient$Builder.setBatchPath
I've noticed that in my google-api-client-1.23.0.jar libray loaded as dependency no setBatchPath was present.
I've tried to find the issue browsing on web but without fortune. I cannot understand which library (and version) I need to install in order to make it works.