最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Java 17 with Google Bigquery `google.cloud.bigquerystorage` library | Compilation fails because of conflicting package - Stack O

programmeradmin3浏览0评论

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.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论