Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests and plugin execution doesn't work on windows #51

Closed
fwolter opened this issue Jul 1, 2021 · 1 comment
Closed

Unit tests and plugin execution doesn't work on windows #51

fwolter opened this issue Jul 1, 2021 · 1 comment

Comments

@fwolter
Copy link
Contributor

fwolter commented Jul 1, 2021

When calling mvn verify in this repo on windows, I receive the following output:

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running name.valery1707.kaitai.KaitaiGeneratorTest
Tests run: 8, Failures: 2, Errors: 3, Skipped: 0, Time elapsed: 8.715 sec <<< FAILURE!
testOption_fromFileClass(name.valery1707.kaitai.KaitaiGeneratorTest)  Time elapsed: 1.108 sec  <<< ERROR!
name.valery1707.kaitai.KaitaiException: Fail to execute kaitai command: Error: Could not find or load main class io.kaitai.struct.JavaMain
Caused by: java.lang.ClassNotFoundException: io.kaitai.struct.JavaMain
        at name.valery1707.kaitai.KaitaiGenerator.execute(KaitaiGenerator.java:310)
        at name.valery1707.kaitai.KaitaiGenerator.generate(KaitaiGenerator.java:329)
        at name.valery1707.kaitai.KaitaiGeneratorTest.testOption_fromFileClass(KaitaiGeneratorTest.java:161)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
        at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
        at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Caused by: org.buildobjects.process.ExternalProcessFailureException: External process 'C:\Users\FABIAN~1\AppData\Local\Temp\junit17435489000324590031\junit5380217142479019709\kaitai-struct-compiler-0.8\kaitai-struct-compiler-0.8\bin\kaitai-struct-compiler.bat --version' returned 1 after 217ms
Stderr unavailable as it has been consumed by user provided stream.
        at org.buildobjects.process.Proc.<init>(Proc.java:124)
        at org.buildobjects.process.ProcBuilder.run(ProcBuilder.java:205)
        at name.valery1707.kaitai.KaitaiGenerator.execute(KaitaiGenerator.java:305)
        ... 35 more

And when using this plugin in a maven project, the same error is generated:

[INFO] --- kaitai-maven-plugin:0.1.7-SNAPSHOT:generate (default-cli) @ org.openhab.binding.bluetooth.daly ---
[INFO] KaiTai distribution: Downloading: https://github.com/kaitai-io/kaitai_struct_compiler/releases/download/0.8/kaitai-struct-compiler-0.8.zip
[INFO] KaiTai distribution: Extracting: C:\Users\Fabian Wolter\.m2\repository\.cache\kaitai\kaitai-struct-compiler-0.8.zip
[INFO] Kaitai: check version
[ERROR] Error: Could not find or load main class io.kaitai.struct.JavaMain
[ERROR] Caused by: java.lang.ClassNotFoundException: io.kaitai.struct.JavaMain
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.070 s (Wall Clock)
[INFO] Finished at: 2021-07-01T00:08:58+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal name.valery1707.kaitai:kaitai-maven-plugin:0.1.7-SNAPSHOT:generate (default-cli) on project org.openhab.binding.bluetooth.daly: Fail to execute kaitai command: Error: Could not find or load main class io.kaitai.struct.JavaMain
[ERROR] Caused by: java.lang.ClassNotFoundException: io.kaitai.struct.JavaMain: External process 'C:\Users\Fabian Wolter\.m2\repository\.cache\kaitai\kaitai-struct-compiler-0.8\kaitai-struct-compiler-0.8\bin\kaitai-struct-compiler.bat --version' returned 1 after 212ms
[ERROR] Stderr unavailable as it has been consumed by user provided stream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

The cause seems kaitai-io/kaitai_struct#822, but I don't know how to fix it as the kaitai struct compiler isn't installed but just downloaded and executed from a cache directory. So, I can't really set the KAITAI_STRUCT_COMPILER_HOME.

@valery1707
Copy link
Owner

As #59 shows, the project builds correctly on both Windows and Linux.
You need to check if the environment on your computer is correct.

@valery1707 valery1707 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants