I'm trying to use the google's library for BQ integration, I'm using maven to manage dependencies and Java 17 for compilation and runtime.
In my pom.xml
I use their BOM for version management, two dependencies for the specific libraries and spring-starter
lib:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.49.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>.springframework.cloud</groupId>
<artifactId>spring-cloud-gcp-starter-bigquery</artifactId>
<version>1.2.8.RELEASE</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-bigquery</artifactId>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-bigquerystorage</artifactId>
</dependency>
</dependencies>
In my module-info.java
I have these two modules as requirements:
requires proto.google.cloud.bigquerystorage.v1;
requires grpc.google.cloud.bigquerystorage.v1;
The moment I try to compile my project, even w/o actually using any of library's classes I get a compilation error:
java: java.lang.reflect.InvocationTargetException
Modules google.cloud.bigquerystorage and grpc.google.cloud.bigquerystorage.v1 export package com.google.cloud.bigquery.storage.v1 to module spring.core
Indeed, both modules have the same package with different classes in them. From what I read about Java 17 JPMS, it, indeed, does not allow importing the same package from two different modules into the same module. In github documentation, on the other hand, it is recommended to use Java 17 for new development. So my question is whether I'm doing something completely wrong, or is there a workaround for this situation? The only option I could think of was to just rebuild the whole BQ library as one big module but this approach has its obvious drawbacks.