I'm using a mac m1 with open jdk 11 and trying to generate using proto definition.
openjdk version "11.0.18" 2023-01-17 LTS OpenJDK Runtime Environment Zulu11.62+17-CA (build 11.0.18+10-LTS) OpenJDK 64-Bit Server VM Zulu11.62+17-CA (build 11.0.18+10-LTS, mixed mode) I have the following defined in the parent pom.
<plugin> <groupId>org.xolstice.maven.plugins</groupId> <artifactId>protobuf-maven-plugin</artifactId> <version>${protobuf-maven-plugin.version}</version> <configuration> <protocArtifact> com.google.protobuf:protoc:3.3.0:exe:${os.detected.classifier} </protocArtifact> <pluginId>grpc-java</pluginId> <pluginArtifact> io.grpc:protoc-gen-grpc-java:1.4.0:exe:${os.detected.classifier} </pluginArtifact> <clearOutputDirectory>false</clearOutputDirectory> </configuration> <executions> <execution> <goals> <goal>compile-custom</goal> <goal>compile</goal> </goals> </execution> </executions> </plugin> When generating I'm getting the following error.
[ERROR] Failed to execute goal org.xolstice.maven.plugins:protobuf-maven-plugin:0.6.1:compile-custom (default) on project com.sample.resource.monitoring.service: Unable to resolve artifact: Missing: [ERROR] ---------- [ERROR] 1) com.google.protobuf:protoc:exe:osx-aarch_64:3.3.0 [ERROR] [ERROR] Try downloading the file manually from the project website. [ERROR] [ERROR] Then, install it using the command: [ERROR] mvn install:install-file -DgroupId=com.google.protobuf -DartifactId=protoc -Dversion=3.3.0 -Dclassifier=osx-aarch_64 -Dpackaging=exe -Dfile=/path/to/file [ERROR] [ERROR] Alternatively, if you host your own repository you can deploy the file there: [ERROR] mvn deploy:deploy-file -DgroupId=com.google.protobuf -DartifactId=protoc -Dversion=3.3.0 -Dclassifier=osx-aarch_64 -Dpackaging=exe -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id] [ERROR] [ERROR] Path to dependency: [ERROR] 1) com.sample:com.sample.resource.monitoring.service:jar:0.0.135-SNAPSHOT [ERROR] 2) com.google.protobuf:protoc:exe:osx-aarch_64:3.3.0 [ERROR] [ERROR] ---------- [ERROR] 1 required artifact is missing. [ERROR] [ERROR] for artifact: [ERROR] com.sample:com.sample.resource.monitoring.service:jar:0.0.135-SNAPSHOT As a work around I upgraded protoc to 3.17.3 and gen-grpc-java to 1.49.1. This fixed the issue but conflicts when I integrate with other services. For some of my fellow devs this works without any issue. So far I have not been able to find what's the issue with existing configurations.
Any idea on how to fix this?
12 Answers
It's known issue: but there are also suggestions what to in that case:
replace
${os.detected.classifier}withosx-x86_64set maven active profile property
os.detected.classifiertoosx-x86_64
I fix with this change:
from:
<configuration> <protocArtifact>com.google.protobuf:protoc:3.17.3:exe:${os.detected.classifier}</protocArtifact> <pluginId>grpc-java</pluginId> <protocArtifact>io.grpc:protoc-gen-grpc-java:1.40.1:exe:${os.detected.classifier}</protocArtifact> </configuration> To:
<configuration> <protocArtifact>com.google.protobuf:protoc:3.17.3:exe:${os.detected.classifier}</protocArtifact> <pluginId>grpc-java</pluginId> <protocArtifact>io.grpc:protoc-gen-grpc-java:1.53.0:exe:${os.detected.classifier}</protocArtifact> </configuration>