protoc-jar-maven-plugin
protoc-jar-maven-plugin copied to clipboard
Not using pre-installed proto with protocCommand
I'm running on GitHub Action on Ubuntu 22.04 with such pom.configuration and experiencing 2 issues:
<plugin>
<groupId>com.github.os72</groupId>
<artifactId>protoc-jar-maven-plugin</artifactId>
<version>3.11.4</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<protocVersion>3.18.3</protocVersion>
<protocCommand>/opt/hostedtoolcache/protoc/3.18.3/x64/bin/protoc</protocCommand>
<inputDirectories>
<include>src/main/resources</include>
</inputDirectories>
<outputTargets>
<outputTarget>
<type>java</type>
</outputTarget>
<outputTarget>
<type>python</type>
<outputDirectory>${project.build.directory}/generated-sources/python
</outputDirectory>
</outputTarget>
</outputTargets>
</configuration>
</execution>
</executions>
</plugin>
If instead of protocCommand I'm using <protocVersion>3.22.2</protocVersion> then I'm not experiencing error - but python generated files - are not full with data - only the header is present. So I'm trying to use 3.18.3 instead - as it generates python files properly - and all is working fine locally, but when I'm trying to release - each time I see this:
11:52:21,662 ***INFO*** 11:52:21,661 ***INFO*** --- protoc-jar-maven-plugin:3.11.4:run (default) @ channel ---
11:52:21,670 ***INFO*** protoc-jar: executing: ***/opt/hostedtoolcache/protoc/3.18.3/x64/bin/protoc, --version***
11:52:21,672 ***INFO*** protoc-jar: caught exception, retrying: java.io.IOException: Cannot run program "/opt/hostedtoolcache/protoc/3.18.3/x64/bin/protoc": error=2, No such file or directory
11:52:22,672 ***INFO*** protoc-jar: executing: ***/opt/hostedtoolcache/protoc/3.18.3/x64/bin/protoc, --version***
11:52:22,674 ***INFO*** protoc-jar: caught exception, retrying: java.io.IOException: Cannot run program "/opt/hostedtoolcache/protoc/3.18.3/x64/bin/protoc": error=2, No such file or directory
11:52:23,674 ***INFO*** protoc-jar: executing: ***/opt/hostedtoolcache/protoc/3.18.3/x64/bin/protoc, --version***
11:52:23,677 ***INFO*** 11:52:23,676 ***INFO*** Protoc version: 3.18.3
11:52:23,680 ***INFO*** protoc-jar: protoc version: 3.18.3, detected platform: linux-x86_64 (linux/amd64)
11:52:23,708 ***INFO*** protoc-jar: using default maven settings, didn't find user settings.xml
11:52:23,709 ***INFO*** protoc-jar: downloading: https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/maven-metadata.xml
11:52:23,749 ***INFO*** protoc-jar: saved: /tmp/protocjar.webcache/com/google/protobuf/protoc/maven-metadata.xml
11:52:23,764 ***INFO*** protoc-jar: using default maven settings, didn't find user settings.xml
11:52:23,765 ***INFO*** protoc-jar: downloading: https://repo.maven.apache.org/maven2/com/github/os72/protoc/maven-metadata.xml
11:52:23,769 ***INFO*** protoc-jar: saved: /tmp/protocjar.webcache/com/github/os72/protoc/maven-metadata.xml
11:52:23,772 ***INFO*** protoc-jar: using default maven settings, didn't find user settings.xml
11:52:23,773 ***INFO*** protoc-jar: cached: /tmp/protocjar.webcache/com/google/protobuf/protoc/maven-metadata.xml
11:52:23,778 ***INFO*** protoc-jar: downloading: https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/3.18.3/protoc-3.18.3-linux-x86_64.exe
11:52:23,937 ***INFO*** protoc-jar: saved: /tmp/protocjar.webcache/com/google/protobuf/protoc/3.18.3/protoc-3.18.3-linux-x86_64.exe
11:52:23,947 ***INFO*** protoc-jar: executing: ***/tmp/protocjar13244875036957776161/bin/protoc.exe, --version***
11:52:23,948 ***INFO*** protoc-jar: caught exception, retrying: java.io.IOException: Cannot run program "/tmp/protocjar13244875036957776161/bin/protoc.exe": error=2, No such file or directory
11:52:24,948 ***INFO*** protoc-jar: executing: ***/tmp/protocjar13244875036957776161/bin/protoc.exe, --version***
11:52:24,950 ***INFO*** protoc-jar: caught exception, retrying: java.io.IOException: Cannot run program "/tmp/protocjar13244875036957776161/bin/protoc.exe": error=2, No such file or directory
11:52:25,950 ***INFO*** protoc-jar: executing: ***/tmp/protocjar13244875036957776161/bin/protoc.exe, --version***
11:52:25,952 ***INFO*** protoc-jar: protoc version: 3.18.3, detected platform: linux-x86_64 (linux/amd64)
11:52:25,957 ***INFO*** protoc-jar: using default maven settings, didn't find user settings.xml
11:52:25,957 ***INFO*** protoc-jar: cached: /tmp/protocjar.webcache/com/google/protobuf/protoc/maven-metadata.xml
11:52:25,964 ***INFO*** protoc-jar: cached: /tmp/protocjar.webcache/com/google/protobuf/protoc/3.18.3/protoc-3.18.3-linux-x86_64.exe
11:52:25,972 ***INFO*** 11:52:25,972 ***INFO*** Protoc command: /root/protocjar78896[850](https://github.com/SafeGuard-Cyber/safeguard-common-events/actions/runs/4637891779/jobs/8207198366#step:12:850)50822779987/bin/protoc.exe
11:52:25,973 ***INFO*** 11:52:25,973 ***INFO*** Input directories:
11:52:25,973 ***INFO*** 11:52:25,973 ***INFO*** /github/workspace/channel/src/main/resources
11:52:25,973 ***INFO*** 11:52:25,973 ***INFO*** Output targets:
11:52:25,974 ***INFO*** 11:52:25,974 ***INFO*** java: /github/workspace/channel/target/generated-sources (add: main, clean: false, plugin: null, outputOptions: null)
11:52:25,974 ***INFO*** 11:52:25,974 ***INFO*** python: /github/workspace/channel/target/generated-sources/python (add: main, clean: false, plugin: null, outputOptions: null)
11:52:25,975 ***INFO*** 11:52:25,974 ***INFO*** /github/workspace/channel/target/generated-sources does not exist. Creating...
11:52:25,975 ***INFO*** 11:52:25,975 ***INFO*** /github/workspace/channel/target/generated-sources/python does not exist. Creating...
11:52:25,984 ***INFO*** 11:52:25,983 ***INFO*** Processing (java): SlackChannelSettings.proto
11:52:25,984 ***INFO*** protoc-jar: executing: ***/root/protocjar7889685050822779987/bin/protoc.exe, -I/github/workspace/channel/src/main/resources, --java_out=/github/workspace/channel/target/generated-sources, /github/workspace/channel/src/main/resources/SlackChannelSettings.proto***
11:52:25,985 ***INFO*** protoc-jar: caught exception, retrying: java.io.IOException: Cannot run program "/root/protocjar7889685050822779987/bin/protoc.exe": error=2, No such file or directory
11:52:26,986 ***INFO*** protoc-jar: executing: ***/root/protocjar7889685050822779987/bin/protoc.exe, -I/github/workspace/channel/src/main/resources, --java_out=/github/workspace/channel/target/generated-sources, /github/workspace/channel/src/main/resources/SlackChannelSettings.proto***
11:52:26,988 ***INFO*** protoc-jar: caught exception, retrying: java.io.IOException: Cannot run program "/root/protocjar7889685050822779987/bin/protoc.exe": error=2, No such file or directory
11:52:27,988 ***INFO*** protoc-jar: executing: ***/root/protocjar7889685050822779987/bin/protoc.exe, -I/github/workspace/channel/src/main/resources, --java_out=/github/workspace/channel/target/generated-sources, /github/workspace/channel/src/main/resources/SlackChannelSettings.proto***
the path is hardcoded now - but I also tried to pass it dynamically with -DprotocCommand=${{ env.PROTOC_COMMAND }} - it is taken from the preinstalled protoc in GitHub:
which protoc
/opt/hostedtoolcache/protoc/3.18.3/x64/bin/protoc
I have checked out several issues - it's not alpine version, gcomat doesn't help... Any Ideas will be really helpful - thanks in advance Java 17
When I do such a request with a command manually - it works fine
/opt/hostedtoolcache/protoc/3.18.3/x64/bin/protoc --version
libprotoc 3.18.3