Re: Maven compiler plugin Unsupported major.minor version

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Maven compiler plugin Unsupported major.minor version

Benjamin Marwell-2
Hi Andrea,

thank you very much! I can confirm that this should not happen.
The error seems to be that the preparePaths method tries to parse the
existing module-info.class, but does not use the Toolchain provided
JDK for this.

The issue for this: https://issues.apache.org/jira/browse/MCOMPILER-455
cc to the dev mailing list. Issue is free to grab. Probably needs to
be fixed in plexus java, therefore also created
https://github.com/codehaus-plexus/plexus-languages/issues/64.

Am Mi., 10. Feb. 2021 um 12:51 Uhr schrieb Andrea Vacondio
<[hidden email]>:

>
> Ok, I created a super simple repo here https://github.com/torakiki/testme
>
> The pom is stripped to the minimum, here are the steps I use to reproduce:
> - git clone https://github.com/torakiki/testme.git
> - mvn compile
> - mvn compile
>
> The first compilation works, the second doesn't unless I clean.
> The error is pretty much the same:
> Execution default-compile of goal
> org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile failed:
> Unsupported major.minor version 59.0
>
> Using Maven 3.6.3
> My toolchain.xml:
> <toolchains>
>   <toolchain>
>     <type>jdk</type>
>     <provides>
>       <version>15</version>
>       <vendor>openjdk</vendor>
>     </provides>
>     <configuration>
>       <jdkHome>/usr/lib/jvm/jdk-15.0.1+9</jdkHome>
>     </configuration>
>   </toolchain>
> </toolchains>
> My .mavenrc:
> export JAVA_HOME=/usr/lib/jvm/jdk-11
>
>
> I'm on Linux but I tested on Windows 7 and got the same result.
> A side note, while with this simple project the first compile works, the
> second doesn't, in my multi-module project with a parent module plus 8
> child modules it fails on the second module with 'mvn clean compile' from
> the parent.
>
> I hope it helps.
> Andrea
>
> Il giorno mar 9 feb 2021 alle ore 21:46 Benjamin Marwell <
> [hidden email]> ha scritto:
>
> > Hi,
> >
> > do you have a public repository to share? Have you tried other JVM
> > implementations? Have you tried cooling without preview features?
> >
> > On Mon, 8 Feb 2021, 15:30 Andrea Vacondio, <[hidden email]>
> > wrote:
> >
> > > Thanks for the reply. I tried that and I got:
> > > [ERROR] Failed to execute goal
> > > org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile
> > > (default-compile) on project pdfblack-model: Execution default-compile of
> > > goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile
> > failed: A
> > > required class was missing while executing
> > > org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile:
> > >
> > org/codehaus/plexus/languages/java/jpms/ResolvePathsResult$ModuleNameSource
> > > [ERROR] -----------------------------------------------------
> > > [ERROR] realm =
> > > plugin>org.apache.maven.plugins:maven-compiler-plugin:3.8.1
> > > [ERROR] strategy =
> > > org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
> > > [ERROR] urls[0] =
> > >
> > file:/home/torakiki/.m2/repository/org/apache/maven/plugins/maven-compiler-plugin/3.8.1/maven-compiler-plugin-3.8.1.jar
> > > [ERROR] urls[1] =
> > >
> > file:/home/torakiki/.m2/repository/org/codehaus/plexus/plexus-java/0.9.11/plexus-java-0.9.11.jar
> > > [ERROR] urls[2] =
> > >
> > file:/home/torakiki/.m2/repository/org/ow2/asm/asm/7.0-beta/asm-7.0-beta.jar
> > > [ERROR] urls[3] =
> > >
> > file:/home/torakiki/.m2/repository/com/thoughtworks/qdox/qdox/2.0-M9/qdox-2.0-M9.jar
> > > [ERROR] urls[4] =
> > >
> > file:/home/torakiki/.m2/repository/org/sonatype/sisu/sisu-inject-bean/1.4.2/sisu-inject-bean-1.4.2.jar
> > > [ERROR] urls[5] =
> > >
> > file:/home/torakiki/.m2/repository/org/sonatype/sisu/sisu-guice/2.1.7/sisu-guice-2.1.7-noaop.jar
> > > [ERROR] urls[6] =
> > >
> > file:/home/torakiki/.m2/repository/org/codehaus/plexus/plexus-utils/2.0.4/plexus-utils-2.0.4.jar
> > > [ERROR] urls[7] =
> > >
> > file:/home/torakiki/.m2/repository/org/sonatype/aether/aether-util/1.7/aether-util-1.7.jar
> > > [ERROR] urls[8] =
> > >
> > file:/home/torakiki/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
> > > [ERROR] urls[9] =
> > >
> > file:/home/torakiki/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.7.1/plexus-component-annotations-1.7.1.jar
> > > [ERROR] urls[10] =
> > >
> > file:/home/torakiki/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
> > > [ERROR] urls[11] =
> > >
> > file:/home/torakiki/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
> > > [ERROR] urls[12] =
> > >
> > file:/home/torakiki/.m2/repository/org/apache/maven/shared/maven-shared-utils/3.2.1/maven-shared-utils-3.2.1.jar
> > > [ERROR] urls[13] =
> > >
> > file:/home/torakiki/.m2/repository/commons-io/commons-io/2.5/commons-io-2.5.jar
> > > [ERROR] urls[14] =
> > >
> > file:/home/torakiki/.m2/repository/org/apache/maven/shared/maven-shared-incremental/1.1/maven-shared-incremental-1.1.jar
> > > [ERROR] urls[15] =
> > >
> > file:/home/torakiki/.m2/repository/org/codehaus/plexus/plexus-compiler-api/2.8.4/plexus-compiler-api-2.8.4.jar
> > > [ERROR] urls[16] =
> > >
> > file:/home/torakiki/.m2/repository/org/codehaus/plexus/plexus-compiler-manager/2.8.4/plexus-compiler-manager-2.8.4.jar
> > > [ERROR] urls[17] =
> > >
> > file:/home/torakiki/.m2/repository/org/codehaus/plexus/plexus-compiler-javac/2.8.4/plexus-compiler-javac-2.8.4.jar
> > > [ERROR] Number of foreign imports: 1
> > > [ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent:
> > > null]]
> > > [ERROR]
> > > [ERROR] -----------------------------------------------------
> > >
> > > I get this error even if I move plexus-java up of one minor version to
> > > plexus-java 0.9.11.
> > > I also tried to update asm with:
> > > <dependencies>
> > >             <dependency>
> > >                <groupId>org.ow2.asm</groupId>
> > >               <artifactId>asm</artifactId>
> > >               <version>9.1</version>
> > >             </dependency>
> > >     </dependencies>
> > > so pexus-java 0.9.10 and asm latest but I got the same original error.
> > > Andrea
> > >
> > >
> > > On 2021/02/07 20:19:40, Benjamin Marwell <[hidden email]> wrote:
> > > > Hi Andrea,
> > > >
> > > > looking at the maven-compiler-plugin, it uses plexus-java 0.9.10 which
> > > > in turn uses an old 6.x asm version.
> > > >
> > > > Try adding a more recent version of plexus-java (which uses asm 9.0)
> > > > and see if that works.
> > > > <plugin>
> > > >     <groupId>org.apache.maven.plugins</groupId>
> > > >     <artifactId>maven-compiler-plugin</artifactId>
> > > >     <version>3.8.1</version>
> > > >     <configuration>
> > > >         <release>15</release>
> > > >         <compilerArgs>
> > > >             <compilerArg>--enable-preview</compilerArg>
> > > >         </compilerArgs>
> > > >     </configuration>
> > > >     <dependency>
> > > >         <groupId>org.codehaus.plexus</groupId>
> > > >         <artifactId>plexus-java</artifactId>
> > > >         <version>1.0.6</version>
> > > >     </dependency>
> > > > </plugin>
> > > >
> > > > If it works, please kindly open a ticket at
> > > > http://issues.apache.org/jira/projects/MCOMPILER with the full stack
> > > > trace.
> > > >
> > > > - Ben
> > > >
> > > > Am Sa., 6. Feb. 2021 um 08:47 Uhr schrieb Andrea Vacondio
> > > > <[hidden email]>:
> > > > >
> > > > > Hi,
> > > > > I hope this is the right channel.
> > > > > I have a multi module project that I'm trying to modularize in the
> > JPMS
> > > > > sense.
> > > > > It's configured to run maven with java 11 and run the compiler plugin
> > > using
> > > > > java 15 through the toolchain plugin and this is what I get:
> > > > >
> > > > > [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @
> > > > > pdfblack-model ---
> > > > > [INFO] Toolchain in maven-compiler-plugin:
> > > JDK[/usr/lib/jvm/jdk-15.0.1+9]
> > > > > [INFO]
> > > > >
> > > ------------------------------------------------------------------------
> > > > > [INFO] BUILD FAILURE
> > > > > [INFO]
> > > > >
> > > ------------------------------------------------------------------------
> > > > > [INFO] Total time:  1.141 s
> > > > > [INFO] Finished at: 2021-02-05T18:07:26+01:00
> > > > > [INFO]
> > > > >
> > > ------------------------------------------------------------------------
> > > > > [ERROR] Failed to execute goal
> > > > > org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile
> > > > > (default-compile) on project pdfblack-model: Execution
> > default-compile
> > > of
> > > > > goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile
> > > failed:
> > > > > Unsupported major.minor version 59.65535 -> [Help 1]
> > > > >
> > > > > I attached the full stacktrace at the bottom.
> > > > > It seems to me the plugin is using jdk11 to do something where it
> > > should
> > > > > use jdk15 from the toolchain but before digging deeper I wanted to
> > > double
> > > > > check if I'm doing anything wrong or if maybe my expectations are
> > > wrong.
> > > > > This is my configuration, nothing special there:
> > > > > <plugin>
> > > > > <groupId>org.apache.maven.plugins</groupId>
> > > > > <artifactId>maven-compiler-plugin</artifactId>
> > > > > <version>3.8.1</version>
> > > > > <configuration>
> > > > > <release>15</release>
> > > > > <compilerArgs>
> > > > > <compilerArg>--enable-preview</compilerArg>
> > > > > </compilerArgs>
> > > > > </configuration>
> > > > > </plugin>
> > > > >
> > > > > This is the stacktrace:
> > > > > Execution default-compile of goal
> > > > > org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile failed:
> > > > > Unsupported major.minor version 59.65535
> > > > >     at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> > > > > (MojoExecutor.java:215)
> > > > >     at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> > > > > (MojoExecutor.java:156)
> > > > >     at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> > > > > (MojoExecutor.java:148)
> > > > >     at
> > > > >
> > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject
> > > > > (LifecycleModuleBuilder.java:117)
> > > > >     at
> > > > >
> > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject
> > > > > (LifecycleModuleBuilder.java:81)
> > > > >     at
> > > > >
> > >
> > org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build
> > > > > (SingleThreadedBuilder.java:56)
> > > > >     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute
> > > > > (LifecycleStarter.java:128)
> > > > >     at org.apache.maven.DefaultMaven.doExecute
> > (DefaultMaven.java:305)
> > > > >     at org.apache.maven.DefaultMaven.doExecute
> > (DefaultMaven.java:192)
> > > > >     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
> > > > >     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
> > > > >     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
> > > > >     at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
> > > > >     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native
> > > Method)
> > > > >     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke
> > > > > (NativeMethodAccessorImpl.java:62)
> > > > >     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke
> > > > > (DelegatingMethodAccessorImpl.java:43)
> > > > >     at java.lang.reflect.Method.invoke (Method.java:566)
> > > > >     at
> > org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced
> > > > > (Launcher.java:282)
> > > > >     at org.codehaus.plexus.classworlds.launcher.Launcher.launch
> > > > > (Launcher.java:225)
> > > > >     at
> > > org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode
> > > > > (Launcher.java:406)
> > > > >     at org.codehaus.plexus.classworlds.launcher.Launcher.main
> > > > > (Launcher.java:347)
> > > > > Caused by: org.apache.maven.plugin.PluginExecutionException:
> > Execution
> > > > > default-compile of goal
> > > > > org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile failed:
> > > > > Unsupported major.minor version 59.65535
> > > > >     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo
> > > > > (DefaultBuildPluginManager.java:148)
> > > > >     at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> > > > > (MojoExecutor.java:210)
> > > > >     at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> > > > > (MojoExecutor.java:156)
> > > > >     at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> > > > > (MojoExecutor.java:148)
> > > > >     at
> > > > >
> > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject
> > > > > (LifecycleModuleBuilder.java:117)
> > > > >     at
> > > > >
> > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject
> > > > > (LifecycleModuleBuilder.java:81)
> > > > >     at
> > > > >
> > >
> > org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build
> > > > > (SingleThreadedBuilder.java:56)
> > > > >     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute
> > > > > (LifecycleStarter.java:128)
> > > > >     at org.apache.maven.DefaultMaven.doExecute
> > (DefaultMaven.java:305)
> > > > >     at org.apache.maven.DefaultMaven.doExecute
> > (DefaultMaven.java:192)
> > > > >     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
> > > > >     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
> > > > >     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
> > > > >     at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
> > > > >     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native
> > > Method)
> > > > >     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke
> > > > > (NativeMethodAccessorImpl.java:62)
> > > > >     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke
> > > > > (DelegatingMethodAccessorImpl.java:43)
> > > > >     at java.lang.reflect.Method.invoke (Method.java:566)
> > > > >     at
> > org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced
> > > > > (Launcher.java:282)
> > > > >     at org.codehaus.plexus.classworlds.launcher.Launcher.launch
> > > > > (Launcher.java:225)
> > > > >     at
> > > org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode
> > > > > (Launcher.java:406)
> > > > >     at org.codehaus.plexus.classworlds.launcher.Launcher.main
> > > > > (Launcher.java:347)
> > > > > Caused by: java.lang.module.InvalidModuleDescriptorException:
> > > Unsupported
> > > > > major.minor version 59.65535
> > > > >     at jdk.internal.module.ModuleInfo.invalidModuleDescriptor
> > > > > (ModuleInfo.java:1091)
> > > > >     at jdk.internal.module.ModuleInfo.doRead (ModuleInfo.java:195)
> > > > >     at jdk.internal.module.ModuleInfo.read (ModuleInfo.java:131)
> > > > >     at java.lang.module.ModuleDescriptor.read
> > > (ModuleDescriptor.java:2487)
> > > > >     at
> > > org.codehaus.plexus.languages.java.jpms.BinaryModuleInfoParser.parse
> > > > > (BinaryModuleInfoParser.java:35)
> > > > >     at
> > > > >
> > >
> > org.codehaus.plexus.languages.java.jpms.AbstractBinaryModuleInfoParser.getModuleDescriptor
> > > > > (AbstractBinaryModuleInfoParser.java:84)
> > > > >     at
> > > org.codehaus.plexus.languages.java.jpms.LocationManager.resolvePaths
> > > > > (LocationManager.java:127)
> > > > >     at org.apache.maven.plugin.compiler.CompilerMojo.preparePaths
> > > > > (CompilerMojo.java:238)
> > > > >     at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute
> > > > > (AbstractCompilerMojo.java:792)
> > > > >     at org.apache.maven.plugin.compiler.CompilerMojo.execute
> > > > > (CompilerMojo.java:187)
> > > > >     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo
> > > > > (DefaultBuildPluginManager.java:137)
> > > > >     at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> > > > > (MojoExecutor.java:210)
> > > > >     at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> > > > > (MojoExecutor.java:156)
> > > > >     at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> > > > > (MojoExecutor.java:148)
> > > > >     at
> > > > >
> > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject
> > > > > (LifecycleModuleBuilder.java:117)
> > > > >     at
> > > > >
> > org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject
> > > > > (LifecycleModuleBuilder.java:81)
> > > > >     at
> > > > >
> > >
> > org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build
> > > > > (SingleThreadedBuilder.java:56)
> > > > >     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute
> > > > > (LifecycleStarter.java:128)
> > > > >     at org.apache.maven.DefaultMaven.doExecute
> > (DefaultMaven.java:305)
> > > > >     at org.apache.maven.DefaultMaven.doExecute
> > (DefaultMaven.java:192)
> > > > >     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
> > > > >     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
> > > > >     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
> > > > >     at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
> > > > >     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native
> > > Method)
> > > > >     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke
> > > > > (NativeMethodAccessorImpl.java:62)
> > > > >     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke
> > > > > (DelegatingMethodAccessorImpl.java:43)
> > > > >     at java.lang.reflect.Method.invoke (Method.java:566)
> > > > >     at
> > org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced
> > > > > (Launcher.java:282)
> > > > >     at org.codehaus.plexus.classworlds.launcher.Launcher.launch
> > > > > (Launcher.java:225)
> > > > >     at
> > > org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode
> > > > > (Launcher.java:406)
> > > > >     at org.codehaus.plexus.classworlds.launcher.Launcher.main
> > > > > (Launcher.java:347)
> > > > >
> > > > > Thanks
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [hidden email]
> > > > For additional commands, e-mail: [hidden email]
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [hidden email]
> > > For additional commands, e-mail: [hidden email]
> > >
> > >
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]