搭建Neovim Java开发环境时mvnw clean install执行报错求助
问题
我正尝试搭建Neovim的Java开发环境,作为新手自行尝试失败后跟着教程操作。先克隆了microsoft/java-debug仓库,执行mvnw clean install时报错:
1 error @ @ [ERROR] The build could not read 2 projects -> [Help 1] [ERROR] [ERROR] The project com.microsoft.java:com.microsoft.java.debug.plugin:0.41.0 (/home/demo/.config/nvim/java-debug/com.microsoft.java.debug.plugin/pom.xml) has 1 error [ERROR] Invalid artifact repository: Unable to provision, see the following errors: [ERROR] [ERROR] 1) Error in custom provider, java.lang.TypeNotPresentException: Type org.eclipse.tycho.core.p2.P2ArtifactRepositoryLayout not present [ERROR] at ClassRealm[extension>org.eclipse.tycho:tycho-maven-plugin:2.7.3, parent: java.net.URLClassLoader@2cb4c3ab] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule) [ERROR] at ClassRealm[extension>org.eclipse.tycho:tycho-maven-plugin:2.7.3, parent: java.net.URLClassLoader@2cb4c3ab] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule) [ERROR] while locating org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout annotated with @com.google.inject.name.Named(value=p2) [ERROR] [ERROR] 1 error: org/eclipse/tycho/core/p2/P2ArtifactRepositoryLayout has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0 [ERROR] [ERROR] The project com.microsoft.java:com.microsoft.java.debug.repository:0.41.0 (/home/demo/.config/nvim/java-debug/com.microsoft.java.debug.repository/pom.xml) has 1 error [ERROR] Invalid artifact repository: Unable to provision, see the following errors: [ERROR] [ERROR] 1) Error in custom provider, java.lang.TypeNotPresentException: Type org.eclipse.tycho.core.p2.P2ArtifactRepositoryLayout not present [ERROR] at ClassRealm[extension>org.eclipse.tycho:tycho-maven-plugin:2.7.3, parent: java.net.URLClassLoader@2cb4c3ab] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule) [ERROR] at ClassRealm[extension>org.eclipse.tycho:tycho-maven-plugin:2.7.3, parent: java.net.URLClassLoader@2cb4c3ab] (via modules: org.eclipse.sisu.wire.WireModule -> org.eclipse.sisu.plexus.PlexusBindingModule) [ERROR] while locating org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout annotated with @com.google.inject.name.Named(value=p2) [ERROR] [ERROR] 1 error: org/eclipse/tycho/core/p2/P2ArtifactRepositoryLayout has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0 [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/ProjectBuildingException
当前处于公网环境,请问该报错是否有可能是防火墙导致的?
回答
- 这个报错不是防火墙导致的,核心原因是Java版本不兼容:
报错日志里明确指出,org/eclipse/tycho/core/p2/P2ArtifactRepositoryLayout类文件是用Java 11(对应class file version 55.0)编译的,但你当前使用的JDK版本仅支持最高Java 8(class file version 52.0),无法加载高版本编译的类文件。 - 解决方法:
- 安装Java 11或更高版本的JDK
- 验证当前终端的JDK版本:执行
java -version,确认输出为11及以上 - 若版本不符,通过设置
JAVA_HOME环境变量切换到高版本JDK - 重新执行
mvnw clean install
内容的提问来源于stack exchange,提问作者user19804865
相关产品推荐
相关产品推荐

