-
Notifications
You must be signed in to change notification settings - Fork 81
Open
Labels
enhancementNew feature or requestNew feature or requestpriority:majorMajor loss of functionMajor loss of function
Description
b. ohnsorg opened MJAR-289 and commented
- Configure a toolchain to use a more recent JDK, e.g. 17
- run mvn clean install with a different (older) JDK, e.g. 11
- maven-jar-plugin bails out with exit code other than 0 from jar command
It seems very likely (see MJAR-62) that this plugin doesn't support toolchains at all. Since packaging as JAR is a basic operation this has to work out of the box, when using toolchains.
Instead current version of maven-jar-plugin runs a jar command that does not create a JAR. Since compilation takes place based on toolchain class files are of format version 61. This is incompatible with the jar command from a JDK 11.
[…]
[INFO] --- maven-compiler-plugin:3.9.0:testCompile (default-testCompile) @ jpianotrain-core ---
[INFO] Toolchain in maven-compiler-plugin: JDK[/opt/jdk-17.0.2/]
[…]
[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ jpianotrain-core ---
[INFO] Toolchain in maven-surefire-plugin: JDK[/opt/jdk-17.0.2/]
[…]
[INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) @ jpianotrain-core ---
[INFO] Building jar: /home/onkobu/svn/jpianotrain/trunk/jpianotrain-core/target/jpianotrain-core-0.0.4-SNAPSHOT.jar
java.lang.module.InvalidModuleDescriptorException: Unsupported major.minor version 61.0
at java.base/jdk.internal.module.ModuleInfo.invalidModuleDescriptor(ModuleInfo.java:1091)
at java.base/jdk.internal.module.ModuleInfo.doRead(ModuleInfo.java:195)
at java.base/jdk.internal.module.ModuleInfo.read(ModuleInfo.java:147)
at java.base/java.lang.module.ModuleDescriptor.read(ModuleDescriptor.java:2553)
at jdk.jartool/sun.tools.jar.Main.addExtendedModuleAttributes(Main.java:2084)
at jdk.jartool/sun.tools.jar.Main.update(Main.java:1018)
at jdk.jartool/sun.tools.jar.Main.run(Main.java:366)
at jdk.jartool/sun.tools.jar.JarToolProvider.run(JarToolProvider.java:37)
at java.base/java.util.spi.ToolProvider.run(ToolProvider.java:137)
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.codehaus.plexus.archiver.jar.JarToolModularJarArchiver.postCreateArchive(JarToolModularJarArchiver.java:114)
at org.codehaus.plexus.archiver.AbstractArchiver.createArchive(AbstractArchiver.java:1066)
at org.apache.maven.archiver.MavenArchiver.createArchive(MavenArchiver.java:676)
at org.apache.maven.plugins.jar.AbstractJarMojo.createArchive(AbstractJarMojo.java:276)
at org.apache.maven.plugins.jar.AbstractJarMojo.execute(AbstractJarMojo.java:307)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)Issue Links:
- MJAR-62 Build-Jdk in Manifest.mf does not reflect which compiler version actually compiled the classes in the jar
Remote Links:
OmSarabeSolutions
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestpriority:majorMajor loss of functionMajor loss of function