blackrock / protoc-jar-maven-plugin

Maven plugin to compile protobuf proto files into java source code
Apache License 2.0
9 stars 3 forks source link

Fix `mvn test` failure from `protoc-jar` module with `FileNotFound Unsupported platform: protoc-2.4.1-osx-aarch_64.exe` #29

Open ee08b397 opened 4 months ago

ee08b397 commented 4 months ago

Describe the bug When running JUnit tests with mvn test, the build failed because the protoc *.exe file is missing from the protoc-jar module. The reason is the packaging didn't happen.

java.lang.AssertionError: test.properties must be preset on test classpath, see https://github.com/takari/takari-plugin-testing-project/blob/master/testproperties.md for me details
    at org.junit.Assert.fail(Assert.java:89)
    at org.junit.Assert.assertTrue(Assert.java:42)
    at org.junit.Assert.assertNotNull(Assert.java:713)
    at io.takari.maven.testing.TestProperties.loadProperties(TestProperties.java:59)
    at io.takari.maven.testing.TestProperties.<init>(TestProperties.java:50)

Btw, looks like "for me details" should be "for more details".

Run Mvn test

[ERROR] io.github.blackrock.protocjar.ProtocTest.testRunProtocCompileShade -- Time elapsed: 0.204 s <<< ERROR!
java.io.FileNotFoundException: Unsupported platform: protoc-2.4.1-osx-aarch_64.exe
    at io.github.blackrock.protocjar.Protoc.extractProtoc(Protoc.java:223)
    at io.github.blackrock.protocjar.Protoc.extractProtoc(Protoc.java:184)
    at io.github.blackrock.protocjar.Protoc.runProtoc(Protoc.java:68)
    at io.github.blackrock.protocjar.Protoc.runProtoc(Protoc.java:55)
    at io.github.blackrock.protocjar.ProtocTest.testRunProtocCompileShade(ProtocTest.java:119)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1597)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1597)

[ERROR] io.github.blackrock.protocjar.ProtocTest.testStdTypes -- Time elapsed: 0.250 s <<< ERROR!
java.io.FileNotFoundException: Unsupported platform: protoc-2.6.1-osx-aarch_64.exe
    at io.github.blackrock.protocjar.Protoc.extractProtoc(Protoc.java:223)
    at io.github.blackrock.protocjar.Protoc.extractProtoc(Protoc.java:184)
    at io.github.blackrock.protocjar.Protoc.runProtoc(Protoc.java:68)
    at io.github.blackrock.protocjar.Protoc.runProtoc(Protoc.java:55)
    at io.github.blackrock.protocjar.ProtocTest.testStdTypes(ProtocTest.java:82)
    at java.base/java.lang.reflect.Method.invoke(Method.java:580)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1597)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1597)

[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR]   MavenUtilTest.testParseSnapshotExeName:60 expected: <protoc-2.4.1-20180823.052533-7-osx-x86_64.exe> but was: <null>
[ERROR] Errors:
[ERROR]   ProtocTest.testRunProtocBasic:36 » FileNotFound Unsupported platform: protoc-2.4.1-osx-aarch_64.exe
[ERROR]   ProtocTest.testRunProtocCompile:99 » FileNotFound Unsupported platform: protoc-2.4.1-osx-aarch_64.exe
[ERROR]   ProtocTest.testRunProtocCompileShade:119 » FileNotFound Unsupported platform: protoc-2.4.1-osx-aarch_64.exe
[ERROR]   ProtocTest.testRunProtocDownloadArtifact:67 » FileNotFound https://repo.maven.apache.org/maven2/com/google/protobuf/protoc/3.4.0/protoc-3.4.0-osx-aarch_64.exe
[ERROR]   ProtocTest.testStdTypes:82 » FileNotFound Unsupported platform: protoc-2.6.1-osx-aarch_64.exe
[INFO]
[ERROR] Tests run: 9, Failures: 1, Errors: 5, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for protoc-jar-maven-plugin 2.0-SNAPSHOT:
[INFO]
[INFO] protoc-jar-maven-plugin ............................ SUCCESS [  0.001 s]
[INFO] protoc-jar ......................................... FAILURE [  2.574 s]
[INFO] maven-plugin ....................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.927 s
[INFO] Finished at: 2024-06-28T18:10:30-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.2.5:test (default-test) on project protoc-jar: There are test failures.

To Reproduce Steps to reproduce the behavior:

  1. Checkout the lastest code.
  2. Run mvn test

Expected behavior Move the maven-assembly-plugin from the package phase to test phase.

Environment (please complete the following information):