COVESA / franca_ara_tools

Translation between Franca Interface Description Language and AUTOSAR XML interface description language
Eclipse Public License 2.0
41 stars 12 forks source link

Build error on jacoco-maven-plugin (0.7.6) w/ JDK 11 #88

Closed jhflow closed 4 years ago

jhflow commented 4 years ago

When building this tool by following the guide, a build error occurred as follows:

$ mvn clean install -Pwith-artop
...
-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Java HotSpot(TM) 64-Bit Server VM warning: Ignoring option PermSize; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: Ignoring option MaxPermSize; support was removed in 8.0
Exception in thread "main" java.lang.reflect.InvocationTargetException
        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:567)
        at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
        at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525)
Caused by: java.lang.RuntimeException: Class java/util/UUID could not be instrumented.
        at org.jacoco.agent.rt.internal_14f7ee5.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:139)
        at org.jacoco.agent.rt.internal_14f7ee5.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:100)
        at org.jacoco.agent.rt.internal_14f7ee5.PreMain.createRuntime(PreMain.java:55)
        at org.jacoco.agent.rt.internal_14f7ee5.PreMain.premain(PreMain.java:47)
        ... 6 more
Caused by: java.lang.NoSuchFieldException: $jacocoAccess
        at java.base/java.lang.Class.getField(Class.java:2004)
        at org.jacoco.agent.rt.internal_14f7ee5.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:137)
        ... 9 more
FATAL ERROR in native method: processing of -javaagent failed
Aborted (core dumped)

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Franca ARA Converter 0.8.0-SNAPSHOT:
[INFO]
[INFO] Franca ARA Converter ............................... SUCCESS [  0.287 s]
[INFO] org.genivi.faracon.targetplatform .................. SUCCESS [  0.038 s]
[INFO] org.genivi.faracon ................................. SUCCESS [  7.103 s]
[INFO] org.genivi.faracon.console ......................... SUCCESS [  0.313 s]
[INFO] org.genivi.faracon.cli ............................. SUCCESS [  0.623 s]
[INFO] org.genivi.faracon.eclipse.ui ...................... SUCCESS [  0.660 s]
[INFO] org.genivi.faracon.tests ........................... FAILURE [  3.291 s]
[INFO] org.genivi.faracon.feature ......................... SKIPPED
[INFO] org.genivi.faracon.console.franca.feature .......... SKIPPED
[INFO] org.genivi.faracon.console.feature ................. SKIPPED
[INFO] org.genivi.faracon.cli.feature ..................... SKIPPED
[INFO] org.genivi.faracon.eclipse.ui.feature .............. SKIPPED
[INFO] org.genivi.faracon.cli.product ..................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  25.957 s
[INFO] Finished at: 2019-08-21T14:46:24+09:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.15:test (test) on project org.genivi.faracon.tests: Execution test of goal org.apache.maven.plugins:maven-surefire-plugin:2.15:test failed: The forked VM terminated without saying properly goodbye. VM crash or System.exit called ?
[ERROR] Command was/bin/sh -c cd /home/jkim/git/github/GENIVI/franca_ara_tools/tests/org.genivi.faracon.tests && /usr/lib/jvm/java-12-oracle/bin/java -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m '-javaagent:/home/jkim/.m2/repository/org/jacoco/org.jacoco.agent/0.7.6.201602180812/org.jacoco.agent-0.7.6.201602180812-runtime.jar=destfile=/home/jkim/git/github/GENIVI/franca_ara_tools/tests/org.genivi.faracon.tests/target/coverage-data/jacoco-ut.exec,excludes=**/*.ecore' -jar /home/jkim/git/github/GENIVI/franca_ara_tools/tests/org.genivi.faracon.tests/target/surefire/surefirebooter6904626765545655238.jar /home/jkim/git/github/GENIVI/franca_ara_tools/tests/org.genivi.faracon.tests/target/surefire/surefire17823252655311648493tmp /home/jkim/git/github/GENIVI/franca_ara_tools/tests/org.genivi.faracon.tests/target/surefire/surefire_02999777576066127780tmp
[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/PluginExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :org.genivi.faracon.tests

I tested w/ both openjdk-11 and oracle-java11, and got the same error.

By googling, I found that this seems a known issue which happens on the old version of jacoco (0.7.6). This issue disappeared when I fixed the version of jacoco-maven-plugin in pom.xml to the latest one (0.8.4).

diff --git a/releng/org.genivi.faracon.parent/pom.xml b/releng/org.genivi.faracon.parent/pom.xml
index 1eeef1f..1d06c86 100644
--- a/releng/org.genivi.faracon.parent/pom.xml
+++ b/releng/org.genivi.faracon.parent/pom.xml
@@ -159,7 +159,7 @@
                        <plugin>
                                <groupId>org.jacoco</groupId>
                                <artifactId>jacoco-maven-plugin</artifactId>
-                               <version>0.7.6.201602180812</version>
+                               <version>0.8.4</version>
                                <configuration>
                                        <excludes>
                                                <exclude>**/*.ecore</exclude>

If there is no dependency on the specific version of jacoco, I would recommend to update the version to 0.8.2 and higher.

jhflow commented 4 years ago

FYI, this issue still happens on Release_0.8.