英文:
(Closed) Maven is not work in Java 11 should I downgrade?
问题
我已经尝试了3个小时来解决这个问题,但我不知道问题出在哪里。
供参考,我正在使用Java 11,并且我正在使用java parbolied 1.18。这是我浪费了这么多时间的错误:
在线程 "main" 中的异常 "java.lang.RuntimeException":创建扩展解析器类时出错:null
at org.parboiled.Parboiled.createParser(Parboiled.java:58)
at com.mycompany.myname.Main.main(Main.java:15)
原因是:java.lang.IllegalArgumentException
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.parboiled.transform.AsmUtils.createClassReader(AsmUtils.java:56)
at org.parboiled.transform.ClassNodeInitializer.process(ClassNodeInitializer.java:62)
at org.parboiled.transform.ParserTransformer.extendParserClass(ParserTransformer.java:44)
at org.parboiled.transform.ParserTransformer.transformParser(ParserTransformer.java:39)
at org.parboiled.Parboiled.createParser(Parboiled.java:54)
... 1 more
这是 pom.xml 文件:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>MyName</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.parboiled/parboiled-java -->
<dependency>
<groupId>org.parboiled</groupId>
<artifactId>parboiled-java</artifactId>
<version>1.1.8</version>
</dependency>
</dependencies>
</project>
英文:
I have been trying to solve this issue for 3 hours and I don't know what the problem is.
For reference I am running Java 11 and I am using java parbolied 1.18. This the error that I have waisted so much time on:
Exception in thread "main" java.lang.RuntimeException: Error creating extended parser class: null
at org.parboiled.Parboiled.createParser(Parboiled.java:58)
at com.mycompany.myname.Main.main(Main.java:15)
Caused by: java.lang.IllegalArgumentException
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.parboiled.transform.AsmUtils.createClassReader(AsmUtils.java:56)
at org.parboiled.transform.ClassNodeInitializer.process(ClassNodeInitializer.java:62)
at org.parboiled.transform.ParserTransformer.extendParserClass(ParserTransformer.java:44)
at org.parboiled.transform.ParserTransformer.transformParser(ParserTransformer.java:39)
at org.parboiled.Parboiled.createParser(Parboiled.java:54)
... 1 more
>This is the pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-
4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>MyName</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.parboiled/parboiled-java -->
<dependency>
<groupId>org.parboiled</groupId>
<artifactId>parboiled-java</artifactId>
<version>1.1.8</version>
</dependency>
</dependencies>
</project>
答案1
得分: 3
问题出在使用的库中,导致了异常:
Exception in thread "main" java.lang.RuntimeException: Error creating extended parser class: null
at org.parboiled.Parboiled.createParser(Parboiled.java:58)
at com.mycompany.myname.Main.main(Main.java:15)
Caused by: java.lang.IllegalArgumentException
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.parboiled.transform.AsmUtils.createClassReader(AsmUtils.java:56)
at org.parboiled.transform.ClassNodeInitializer.process(ClassNodeInitializer.java:62)
at org.parboiled.transform.ParserTransformer.extendParserClass(ParserTransformer.java:44)
at org.parboiled.transform.ParserTransformer.transformParser(ParserTransformer.java:39)
at org.parboiled.Parboiled.createParser(Parboiled.java:54)
正好显示它正在使用 asm 访问类文件,这是依赖于 JDK 的,需要在代码中升级/更新以正确地与 JDK 11 一起使用。引用的库 在 JDK 11 下无法正常工作。已经有一些与 JDK 11 相关的问题。
这与 Maven 无关。Maven 可以在最新版本的 JDK 15...16(EA)...等上正常工作。
英文:
The problem is located in the used library cause the exception:
Exception in thread "main" java.lang.RuntimeException: Error creating extended parser class: null
at org.parboiled.Parboiled.createParser(Parboiled.java:58)
at com.mycompany.myname.Main.main(Main.java:15)
Caused by: java.lang.IllegalArgumentException
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.parboiled.transform.AsmUtils.createClassReader(AsmUtils.java:56)
at org.parboiled.transform.ClassNodeInitializer.process(ClassNodeInitializer.java:62)
at org.parboiled.transform.ParserTransformer.extendParserClass(ParserTransformer.java:44)
at org.parboiled.transform.ParserTransformer.transformParser(ParserTransformer.java:39)
at org.parboiled.Parboiled.createParser(Parboiled.java:54)
exactly shows that it is using asm access to class files which is JDK dependent which needs to be upgraded/updated in the code to work correctly with JDK 11. The referenced library is not working with JDK 11. Already has several issues related to JDK11.
This has nothing to do with Maven. Maven works up to most recent versions of JDK 15...16(EA)...etc.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论