xolstice / protobuf-maven-plugin

Maven Plugin that executes the Protocol Buffers (protoc) compiler
https://www.xolstice.org/protobuf-maven-plugin/
Other
232 stars 76 forks source link

ERROR] protoc-gen-grpc-java-1.62.2-osx-aarch_64.exe: program not found or is not executable #117

Open siddhsql opened 2 months ago

siddhsql commented 2 months ago

Describe the bug

I get above error when trying to compile protobuf file using protobuf-maven-plugin as described here for example. The funny thing is that the program its complaining about exists! (see details below)

Environment

Apache Maven 3.9.4 (dfbb324ad4a7c8fb0bf182e6d91b0ae20e3d2dd9)
Maven home: /Library/Java/apache-maven-3.9.4
Java version: 21.0.1, vendor: Oracle Corporation, runtime: /Library/Java/jdk-21.0.1.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "13.5.2", arch: "aarch64", family: "mac"

Standalone or IDE

standalone

Plugin configuration

<properties>
        <protobuf.plugin.version>0.6.1</protobuf.plugin.version>
        <protoc.version>3.25.3</protoc.version>
        <grpc.version>1.62.2</grpc.version>
    </properties>
...
<build>
        <plugins>
            <!-- https://github.com/saturnism/grpc-by-example-java/blob/master/pom.xml -->
            <plugin>
                    <groupId>org.xolstice.maven.plugins</groupId>
                    <artifactId>protobuf-maven-plugin</artifactId>
                    <version>${protobuf.plugin.version}</version>
                    <configuration>                  
                        <protocArtifact>com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier}</protocArtifact>
                        <pluginId>grpc-java</pluginId>
                        <pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}</pluginArtifact>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>compile</goal>
                                <goal>compile-custom</goal>
                            </goals>
                        </execution>
                    </executions>
            </plugin>
        </plugins>
    </build>

To Reproduce Steps to reproduce the behavior:

  1. mvn compile

Log output

[INFO] --- protobuf:0.6.1:compile-custom (default) @ grpc-schema ---
[DEBUG] Loading mojo org.xolstice.maven.plugins:protobuf-maven-plugin:0.6.1:compile-custom from plugin realm ClassRealm[plugin>org.xolstice.maven.plugins:protobuf-maven-plugin:0.6.1, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@1cf4f579]
[DEBUG] Configuring mojo execution 'org.xolstice.maven.plugins:protobuf-maven-plugin:0.6.1:compile-custom:default' with basic configurator -->
[DEBUG]   (f) attachDescriptorSet = false
[DEBUG]   (f) attachProtoSources = true
[DEBUG]   (f) checkStaleness = false
[DEBUG]   (f) clearOutputDirectory = true
[DEBUG]   (f) descriptorSetFileName = grpc-schema-1.0.0-SNAPSHOT.protobin
[DEBUG]   (f) descriptorSetOutputDirectory = /Users/xxx/code/xxx/grpc-schema/target/generated-resources/protobuf/descriptor-sets
[DEBUG]   (f) forceMojoExecution = false
[DEBUG]   (f) hashDependentPaths = true
[DEBUG]   (f) includeDependenciesInDescriptorSet = false
[DEBUG]   (f) includeSourceInfoInDescriptorSet = false
[DEBUG]   (f) localRepository =       id: local
      url: file:///Users/xxx/.m2/repository/
   layout: default
snapshots: [enabled => true, update => always]
 releases: [enabled => true, update => always]
   blocked: false

[DEBUG]   (f) outputBaseDirectory = /Users/xxx/code/xxx/grpc-schema/target/generated-sources/protobuf
[DEBUG]   (f) pluginArtifact = io.grpc:protoc-gen-grpc-java:1.62.2:exe:osx-aarch_64
[DEBUG]   (f) pluginId = grpc-java
[DEBUG]   (f) project = MavenProject: xxx:grpc-schema:1.0.0-SNAPSHOT @ /Users/xxx/code/xxx/grpc-schema/pom.xml
[DEBUG]   (f) protoSourceRoot = /Users/xxx/code/xxx/grpc-schema/src/main/proto
[DEBUG]   (f) protocArtifact = com.google.protobuf:protoc:3.25.3:exe:osx-aarch_64
[DEBUG]   (f) protocPluginDirectory = /Users/xxx/code/xxx/grpc-schema/target/protoc-plugins
[DEBUG]   (f) remoteRepositories = [      id: central
      url: https://repo.maven.apache.org/maven2
   layout: default
snapshots: [enabled => false, update => daily]
 releases: [enabled => true, update => daily]
   blocked: false
]
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@56928e17
[DEBUG]   (f) skip = false
[DEBUG]   (f) staleMillis = 0
[DEBUG]   (f) tempDirectory = /Users/xxx/code/xxx/grpc-schema/target
[DEBUG]   (f) temporaryProtoFileDirectory = /Users/xxx/code/xxx/grpc-schema/target/protoc-dependencies
[DEBUG]   (f) useArgumentFile = false
[DEBUG]   (f) writeDescriptorSet = false
[DEBUG] -- end configuration --
[DEBUG] Resolved artifact: com.google.protobuf:protoc:exe:osx-aarch_64:3.25.3:runtime
[DEBUG] Executable file already exists: /Users/xxx/code/xxx/grpc-schema/target/protoc-plugins/protoc-3.25.3-osx-aarch_64.exe
[DEBUG] Resolved artifact: io.grpc:protoc-gen-grpc-java:exe:osx-aarch_64:1.62.2:runtime
[DEBUG] Executable file already exists: /Users/xxx/code/xxx/grpc-schema/target/protoc-plugins/protoc-gen-grpc-java-1.62.2-osx-aarch_64.exe
[DEBUG] Proto source root:
[DEBUG]  /Users/xxx/code/xxx/grpc-schema/src/main/proto
[DEBUG] [PROTOC] Executable:
[DEBUG] [PROTOC]  /Users/xxx/code/xxx/grpc-schema/target/protoc-plugins/protoc-3.25.3-osx-aarch_64.exe
[DEBUG] [PROTOC] Protobuf import paths:
[DEBUG] [PROTOC]  /Users/xxx/code/xxx/grpc-schema/src/main/proto
[DEBUG] [PROTOC] Protobuf descriptors:
[DEBUG] [PROTOC]  /Users/xxx/code/xxx/grpc-schema/src/main/proto/collections.proto
[DEBUG] [PROTOC] Command line options:
[DEBUG] [PROTOC] --proto_path=/Users/xxx/code/xxx/grpc-schema/src/main/proto --plugin=protoc-gen-grpc-java=/Users/xxx/code/xxx/grpc-schema/target/protoc-plugins/protoc-gen-grpc-java-1.62.2-osx-aarch_64.exe --grpc-java_out=/Users/xxx/code/xxx/grpc-schema/target/generated-sources/protobuf/grpc-java /Users/xxx/code/xxx/grpc-schema/src/main/proto/collections.proto
[INFO] Compiling 1 proto file(s) to /Users/xxx/code/xxx/grpc-schema/target/generated-sources/protobuf/grpc-java
[ERROR] PROTOC FAILED: /Users/xxx/code/xxx/grpc-schema/target/protoc-plugins/protoc-gen-grpc-java-1.62.2-osx-aarch_64.exe: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
--grpc-java_out: protoc-gen-grpc-java: Plugin failed with status code 1.

Expected behavior

no error.

Additional context

why is it complaining when executable actually exists!

ls -al /Users/xxx/code/xxx/grpc-schema/target/protoc-plugins/protoc-gen-grpc-java-1.62.2-osx-aarch_64.exe                                                                                                                                    [git:mychanges] ✖
-rwxr--r--@ 1 xxx  staff  6221880 Apr  8 12:04 /Users/xxx/code/xxx/grpc-schema/target/protoc-plugins/protoc-gen-grpc-java-1.62.2-osx-aarch_64.exe

even in the log it says:

[DEBUG] Executable file already exists: /Users/xxx/code/xxx/grpc-schema/target/protoc-plugins/protoc-gen-grpc-java-1.62.2-osx-aarch_64.exe