-
Notifications
You must be signed in to change notification settings - Fork 1
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
CI targeting current JDK #86
Conversation
This property will be used on `maven.compiler.source` and on `maven.compiler.target`.
Build with JDK >= 12 is failing with some Javadoc or Apache Maven Javadoc Plugin error:
Build with JDK >= 15 is failing with some PMD or Apache Maven PMD Plugin error:
Build with JDK >= 18 is failing with some JaCoCo Maven Plug-in error:
|
Also, just missed that for JDK 21 the fail is related with some error with Animal Sniffer Maven Plugin
|
Windows is not handling well the dot (.) and the build fails with the following error message: ``` Error: Unknown lifecycle phase ".version=18". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: pre-clean, clean, post-clean, validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-site, site, post-site, site-deploy. -> [Help 1] ``` Fix by simply not using the dot. Now the property is just `bytecode`. Similar to 291a40d (PR #63)
7c878b7
to
6f1f5f2
Compare
force-pushed because I had forgotten to update two properties |
I did some commits (477a24f, b48ae5b) to troubleshoot the Javadoc problem but the checks for some JDK versions are failing before Javadoc generation. JDK >= 18 is failing on JaCoCo report after test execution and JDK 21 is failing after compilation on Animal Sniffer analysis. let's fix these issues first! |
We are on the latest versions of Animal Sniffer Maven Plugin (1.23). This version does not support class file major version 65 (Java 21). Configured the build to skip the plugin when target is Java 21 bytecode. Otherwise the build fail with the following error: ``` Error: Bad class file /home/runner/work/jaguar2/jaguar2/jaguar2-api/target/classes/br/usp/each/saeg/jaguar2/api/Heuristic.class Error: Failed to execute goal org.codehaus.mojo:animal-sniffer-maven-plugin:1.23:check (default) on project jaguar2-api: Failed to check signatures: Bad class file /home/runner/work/jaguar2/jaguar2/jaguar2-api/target/classes/br/usp/each/saeg/jaguar2/api/Heuristic.class: Unsupported class file major version 65 -> [Help 1] ``` Since actually we are troubleshooting the pull request #86 I have the full error when running with debug: ``` Error: Failed to execute goal org.codehaus.mojo:animal-sniffer-maven-plugin:1.23:check (default) on project jaguar2-api: Failed to check signatures: Bad class file /home/runner/work/jaguar2/jaguar2/jaguar2-api/target/classes/br/usp/each/saeg/jaguar2/api/Heuristic.class: Unsupported class file major version 65 -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:animal-sniffer-maven-plugin:1.23:check (default) on project jaguar2-api: Failed to check signatures at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:333) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174) at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75) at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162) at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283) at org.apache.maven.cli.MavenCli.main (MavenCli.java:206) at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103) at java.lang.reflect.Method.invoke (Method.java:580) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348) at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103) at java.lang.reflect.Method.invoke (Method.java:580) at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39) at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122) at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:61) Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to check signatures at org.codehaus.mojo.animal_sniffer.maven.CheckSignatureMojo.execute (CheckSignatureMojo.java:300) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174) at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75) at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162) at org.codehaus.mojo.animal_sniffer.ClassFileVisitor.process (ClassFileVisitor.java:110) at org.codehaus.mojo.animal_sniffer.ClassFileVisitor.process (ClassFileVisitor.java:94) at org.codehaus.mojo.animal_sniffer.ClassFileVisitor.processDirectory (ClassFileVisitor.java:177) at org.codehaus.mojo.animal_sniffer.ClassFileVisitor.process (ClassFileVisitor.java:110) at org.codehaus.mojo.animal_sniffer.ClassFileVisitor.process (ClassFileVisitor.java:94) at org.codehaus.mojo.animal_sniffer.ClassFileVisitor.processDirectory (ClassFileVisitor.java:177) at org.codehaus.mojo.animal_sniffer.ClassFileVisitor.process (ClassFileVisitor.java:110) at org.codehaus.mojo.animal_sniffer.ClassFileVisitor.process (ClassFileVisitor.java:94) at org.codehaus.mojo.animal_sniffer.ClassFileVisitor.processDirectory (ClassFileVisitor.java:177) at org.codehaus.mojo.animal_sniffer.ClassFileVisitor.process (ClassFileVisitor.java:110) at org.codehaus.mojo.animal_sniffer.maven.CheckSignatureMojo.apply (CheckSignatureMojo.java:382) at org.codehaus.mojo.animal_sniffer.maven.CheckSignatureMojo.buildPackageList (CheckSignatureMojo.java:375) at org.codehaus.mojo.animal_sniffer.maven.CheckSignatureMojo.execute (CheckSignatureMojo.java:246) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174) at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75) at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162) at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283) at org.apache.maven.cli.MavenCli.main (MavenCli.java:206) at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103) at java.lang.reflect.Method.invoke (Method.java:580) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348) at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103) at java.lang.reflect.Method.invoke (Method.java:580) at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39) at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122) at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:61) ```
Okay, now all build for JDK >= 18 is failing on JaCoCo report (including JDK 21). |
This version have official suport for Java 17 and 18 class files and also have experimental support for Java 19 class files. Previos version only officially supports Java 15 and 16 class files and experimental support for Java 17 class files. This should fix the errors like: ``` Error: Failed to execute goal org.jacoco:jacoco-maven-plugin:0.8.7:report (report) on project jaguar2-api: An error has occurred in JaCoCo report generation.: Error while creating report: Error while analyzing /home/runner/work/jaguar2/jaguar2/jaguar2-api/target/classes/br/usp/each/saeg/jaguar2/spi/SpectrumExporter.class. Unsupported class file major version 62 -> [Help 1] ``` Caused by: ``` Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 62 at org.jacoco.agent.rt.internal_3570298.asm.ClassReader.<init>(ClassReader.java:196) at org.jacoco.agent.rt.internal_3570298.asm.ClassReader.<init>(ClassReader.java:177) at org.jacoco.agent.rt.internal_3570298.asm.ClassReader.<init>(ClassReader.java:163) at org.jacoco.agent.rt.internal_3570298.core.internal.instr.InstrSupport.classReaderFor(InstrSupport.java:280) at org.jacoco.agent.rt.internal_3570298.core.instr.Instrumenter.instrument(Instrumenter.java:76) at org.jacoco.agent.rt.internal_3570298.core.instr.Instrumenter.instrument(Instrumenter.java:108) ```
f71ae81
to
24a69e4
Compare
force-push only to trigger CI that was not executed! |
This version have official suport for Java 19 and 20 class files and also have experimental support for Java 21 class files. Previos version only officially supports Java 17 and 18 class files and experimental support for Java 19 class files. This should fix the errors like: ``` Error: Failed to execute goal org.jacoco:jacoco-maven-plugin:0.8.8:report (report) on project jaguar2-api: An error has occurred in JaCoCo report generation.: Error while creating report: Error while analyzing /home/runner/work/jaguar2/jaguar2/jaguar2-api/target/classes/br/usp/each/saeg/jaguar2/api/IBundleSpectrum.class with JaCoCo 0.8.8.202204050719/5dcf34a. Unsupported class file major version 64 ``` That also cause errors on instrumentation Caused by: ``` Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 64 at org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader.<init>(ClassReader.java:199) at org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader.<init>(ClassReader.java:180) at org.jacoco.agent.rt.internal_b6258fc.asm.ClassReader.<init>(ClassReader.java:166) at org.jacoco.agent.rt.internal_b6258fc.core.internal.instr.InstrSupport.classReaderFor(InstrSupport.java:280) at org.jacoco.agent.rt.internal_b6258fc.core.instr.Instrumenter.instrument(Instrumenter.java:77) at org.jacoco.agent.rt.internal_b6258fc.core.instr.Instrumenter.instrument(Instrumenter.java:109) ... 49 more ```
now all build for JDK >= 15 is failing on PMD Maven goal. Let's try to fix it! |
Back from my vacations... Let's see what is happening here! |
Since the PR is open aboud 2 months, lets confirm if the build is still working. Regarding last commitns, please check the JaCoCo documentation to verify the supported JDK versions. See: https://www.jacoco.org/jacoco/trunk/doc/changes.html
Looks that the build is working as expected (same result from last commit). So let's try to fix the issues with PMD |
…perty value On this PR (#86) commits a09262a, 03f5e17 and 6f1f5f2 we introduced the property `bytecode` used as the value of `maven.compiler.source` and `maven.compiler.target` properties. This introduced an issue with PMD and Apache Maven PMD Plugin: ``` Error: Failed to execute goal org.apache.maven.plugins:maven-pmd-plugin:3.13.0:pmd (pmd) on project jaguar2-api: Execution pmd of goal org.apache.maven.plugins:maven-pmd-plugin:3.13.0:pmd failed: org.apache.maven.reporting.MavenReportException: Unsupported targetJdk value '15'. ``` With the following exception: ``` org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-pmd-plugin:3.13.0:pmd (pmd) on project jaguar2-api: Execution pmd of goal org.apache.maven.plugins:maven-pmd-plugin:3.13.0:pmd failed: org.apache.maven.reporting.MavenReportException: Unsupported targetJdk value '15'. at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:333) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174) at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75) at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162) at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159) at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions (MojoExecutor.java:448) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:311) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174) at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75) at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162) at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283) at org.apache.maven.cli.MavenCli.main (MavenCli.java:206) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:64) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:564) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:64) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:564) at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39) at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122) at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:61) Caused by: org.apache.maven.plugin.PluginExecutionException: Execution pmd of goal org.apache.maven.plugins:maven-pmd-plugin:3.13.0:pmd failed: org.apache.maven.reporting.MavenReportException: Unsupported targetJdk value '15'. at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:133) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174) at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75) at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162) at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159) at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions (MojoExecutor.java:448) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:311) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174) at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75) at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162) at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283) at org.apache.maven.cli.MavenCli.main (MavenCli.java:206) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:64) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:564) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:64) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:564) at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39) at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122) at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:61) Caused by: java.lang.RuntimeException: org.apache.maven.reporting.MavenReportException: Unsupported targetJdk value '15'. at org.apache.maven.plugins.pmd.PmdReport.canGenerateReport (PmdReport.java:363) at org.apache.maven.reporting.AbstractMavenReport.execute (AbstractMavenReport.java:120) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174) at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75) at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162) at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159) at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions (MojoExecutor.java:448) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:311) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174) at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75) at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162) at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283) at org.apache.maven.cli.MavenCli.main (MavenCli.java:206) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:64) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:564) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:64) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:564) at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39) at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122) at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:61) Caused by: org.apache.maven.reporting.MavenReportException: Unsupported targetJdk value '15'. at org.apache.maven.plugins.pmd.PmdReport.getPMDConfiguration (PmdReport.java:726) at org.apache.maven.plugins.pmd.PmdReport.executePmd (PmdReport.java:411) at org.apache.maven.plugins.pmd.PmdReport.executePmdWithClassloader (PmdReport.java:376) at org.apache.maven.plugins.pmd.PmdReport.canGenerateReport (PmdReport.java:350) at org.apache.maven.reporting.AbstractMavenReport.execute (AbstractMavenReport.java:120) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174) at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75) at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162) at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159) at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions (MojoExecutor.java:448) at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:311) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174) at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75) at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162) at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39) at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261) at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173) at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101) at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283) at org.apache.maven.cli.MavenCli.main (MavenCli.java:206) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:64) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:564) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283) at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407) at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:64) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke (Method.java:564) at org.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39) at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122) at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:61) ``` This is happening because we are using Apache Maven PMD Plugin version 3.13.0 (due to the issue #76) and this version rely on PMD version 6.21.0 that only supports Java source code up to version 13. See: https://maven.apache.org/plugins/maven-pmd-plugin/examples/upgrading-PMD-at-runtime.html See: https://github.com/apache/maven-pmd-plugin/blob/maven-pmd-plugin-3.13.0/pom.xml#L91 See: https://github.com/apache/maven-pmd-plugin/blob/maven-pmd-plugin-3.13.0/src/main/java/org/apache/maven/plugins/pmd/PmdReport.java#L721-L728 See: https://github.com/pmd/pmd/blob/pmd_releases/6.21.0/pmd-core/src/main/java/net/sourceforge/pmd/lang/LanguageRegistry.java See: https://github.com/pmd/pmd/blob/pmd_releases/6.21.0/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/JavaLanguageModule.java By default Maven PMD Plugin set the `targetJdk` parameter to the value of `maven.compiler.source` property. See: https://maven.apache.org/plugins/maven-pmd-plugin/pmd-mojo.html#targetJdk And that's why the build is failing. This commit decouple the Java source code version from the bytecode version. This is a good enhancment, because in fact, even if we build the project targeting a different bytecode version than the default (1.6) the source code will still be on the version 1.6 (the default). For builds using JDK >= 12 and JDK >= 20 we set the `source` property to 1.7 and 1.8, respectively, because those compilers do not accept older versions. Obviously, if using the JDK 6/7 toolchain we will reset those values to the default one (1.6). On the CI results of the previous commit, we can see that this error is affecting any JDK >= 15. So the error `Unsupported targetJdk value` will reflect the `bydecode` version we are targeting. Note that this error should also happen with JDK 14, but with this JDK the build is failing with to another error (Javadoc) before PMD execution. See also: #86 #76
Yay, looks that the problems related to Javadoc (JDK 12, 13 and 14) were also fixed by the previous commit. |
Looks that now we are facing problems with some access restrictions to modules on newer Java versions. Based on the tests that are failing I bet is something related with the version of Mockito we are using (that is very old) The error is:
The weird part is that this errors only showed up now with the current code changes. |
We are facing a build error with the following message: ``` Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @55a093de ``` This is affecting builds with JDK >= 16. Downgrading JaCoCo from 0.8.9 to check if is something ralated this version.
Is definitely something related with JaCoCo 0.8.9. Looks that after downgrade to JaCoCo 0.8.8 the build with JDK 16, 17, 18 and 19 become green. Obviously the build with JDK 20 and 21 is not working as JaCoCo 0.8.8 does not support those bytecode versions. |
After some digging I found it. JaCoCo 0.8.9 fixed an issue that opens See: jacoco/jacoco#1334 and jacoco/jacoco#1328 Before the fix, JaCoCo was hiding a Mockito issue as module See: #87 I'll try this workaround before check if update Mockito will do the definitive fix. |
This is only for JDK >= 16. Without this fix some unit tests that uses Mockito will fail with the following error: ``` Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @cafebabe ``` We notice this error only after upgrade JaCoCo to version 0.8.9 because prior this version the error was being hide by a side effect of JaCoCo. See: jacoco/jacoco#1334 See: jacoco/jacoco#1328 See: #86 (comment) See: #86 (comment) See: #86 (comment) See: #87 This is a workaround and the added profile should be removed in the future in order of a definitive fix (maybe Mockito upgrade). This reverts commit 31a8d68.
After a deeper inspection on the logs I noticed that PMD is not working for JDK >= 14. This make some sense, since the version of PMD we are using only support Java source code up to version 13. I was expecting it to work if the source was <= 13 but bytecode version >= 14. But didn't work. PMD rely on ASM for type resolution (See: https://pmd.github.io/pmd/pmd_languages_java.html#type-and-symbol-resolution) and the version of ASM does not support class file major version 58 (Java 14). This is the error found in
At least the build is green. I hope when upgrade PMD plugin the problem goes away. Maybe we can address this issue whiten #76. |
Those changes were required by JDK >= 16 due to a Mockito issue. See: #86 (comment) See: commit cc461cd After some trial and error I verified that the issue was fixed between version (2.17.0, 2.18.0]. I don't know exactly wich version because not all 2.17.x versions are available on Maven Central and I only tested versions that are available there. Anyway, the important is that the issue was fixed and this hold true up to the latest Mockito 2 version. So the workaround added by cc461cd is not required anymore. fix #90
No description provided.