google-cloud-java
google-cloud-java copied to clipboard
split package issue with google.cloud.vision java 11
Environment details
- Specify the API at the beginning of the title : google.cloud.vision, com.google.api.grpc
- OS type and version: Ubuntu 16.04
- Java version: Java11
- google-cloud-vision version(s): 1.82.0
Steps to reproduce
- Create a spring boot project
- Change the project SDK to Java 9 or above. I use Java 11 (Amazon Cornetto OpenJDK) 3, Add google-cloud-vision in pom.xml
- Add requires google.cloud.vision; and requires proto.google.cloud.vision.v1; in module.java
- Run the spring boot application.
- Following errors pop up
Stack trace
[ERROR] module lombok reads package com.google.cloud.vision.v1 from both proto.google.cloud.vision.v1 and google.cloud.vision
[ERROR] the unnamed module reads package com.google.cloud.vision.v1 from both proto.google.cloud.vision.v1 and google.cloud.vision
[ERROR] module fuzzywuzzy reads package com.google.cloud.vision.v1 from both proto.google.cloud.vision.v1 and google.cloud.vision
[ERROR] module protobuf.java reads package com.google.cloud.vision.v1 from both proto.google.cloud.vision.v1 and google.cloud.vision
[ERROR] module spring.core reads package com.google.cloud.vision.v1 from both proto.google.cloud.vision.v1 and google.cloud.vision
[ERROR] module org.hibernate.orm.envers reads package com.google.cloud.vision.v1 from both proto.google.cloud.vision.v1 and google.cloud.vision
[ERROR] module java.persistence reads package com.google.cloud.vision.v1 from both proto.google.cloud.vision.v1 and google.cloud.vision
[ERROR] module graphql.java.tools reads package com.google.cloud.vision.v1 from both proto.google.cloud.vision.v1 and google.cloud.vision
[ERROR] module spring.data.commons reads package com.google.cloud.vision.v1 from both proto.google.cloud.vision.v1 and google.cloud.vision
[ERROR] module spring.beans reads package com.google.cloud.vision.v1 from both proto.google.cloud.vision.v1 and google.cloud.vision
[ERROR] module spring.web reads package com.google.cloud.vision.v1 from both proto.google.cloud.vision.v1 and google.cloud.vision
[ERROR] module spring.context reads package com.google.cloud.vision.v1 from both proto.google.cloud.vision.v1 and google.cloud.vision
[ERROR] module org.mapstruct.processor reads package com.google.cloud.vision.v1 from both proto.google.cloud.vision.v1 and google.cloud.vision
[ERROR] module google.cloud.vision reads package com.google.cloud.vision.v1 from both proto.google.cloud.vision.v1 and google.cloud.vision
[ERROR] module proto.google.cloud.vision.v1 reads package com.google.cloud.vision.v1 from both google.cloud.vision and proto.google.cloud.vision.v1
[ERROR] module spring.boot reads package com.google.cloud.vision.v1 from both proto.google.cloud.vision.v1 and google.cloud.vision
Thanks!
Do we have any update on this?
@ashishchopra can you please share your list of dependencies and module.java.
Dependencies:
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.9.0-rc-1</version>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-vision</artifactId>
<version>1.82.0</version>
</dependency>
module.java:
requires google.cloud.vision;
requires proto.google.cloud.vision.v1;
This looks like an issue with how we have our packages split up into (at least) 3 artifacts. For the vision example, we create distinct classes in the com.google.cloud.vision.v1 package in proto-google-cloud-vision-v1, grpc-google-cloud-vision-v1 and google-cloud-vision.
This setup has been around for a few years and will be non-trivial to fix without potentially causing other dependency issues in the ecosystem and not breaking the interface.
HI @chingor13 Do you foresee any timeline for this change and do you have a suggestion on an alternative way to make it work meanwhile?
I think the least painful way forward is to ship a new single artifact that repackages everything into a new package com.google.cloud.vision.v2. Clients will have to change their source code to import the new package instead of com.google.cloud.vision.v1. However that's a straight-forward search and replace.
Alternately, we could keep three Maven artifacts and use three new packages.
Hi, @chingor13 It will be very helpful if you can give us some timeline for this fix. A very important functionality our application depends on this fix.
We don't have a timeline on a fix for this right now. If you have a support contract, then please submit an additional ticket to help us prioritize.
As for the current status, we are currently starting discussions about how to go about fixing this.
We are working on a plan for module support, but for now, this is blocked (grpc also has this issue)
Obsolete.
same issue. is there a fix yet?
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project GraphitiAppMaven: Compilation failure: Compilation failure:
[ERROR] the unnamed module reads package com.google.cloud.vision.v1 from both google.cloud.vision and proto.google.cloud.vision.v1
[ERROR] module com.google.protobuf reads package com.google.cloud.vision.v1 from both google.cloud.vision and proto.google.cloud.vision.v1
[ERROR] module proto.google.cloud.vision.v1 reads package com.google.cloud.vision.v1 from both google.cloud.vision and proto.google.cloud.vision.v1
[ERROR] module google.cloud.vision reads package com.google.cloud.vision.v1 from both google.cloud.vision and proto.google.cloud.vision.v1
[ERROR] module gax reads package com.google.cloud.vision.v1 from both google.cloud.vision and proto.google.cloud.vision.v1
[ERROR] module com.google.auth.oauth2 reads package com.google.cloud.vision.v1 from both google.cloud.vision and proto.google.cloud.vision.v1
[ERROR] /C:/Users/smart/IdeaProjects/GraphitiAppMaven/src/main/java/module-info.java:[1,1] module com.graphitiapp.graphitiappmaven reads package com.google.cloud.vision.v1 from both google.cloud.vision and proto.google.cloud.vision.v1
dependencies:
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>