相关疑难解决方法(0)

无法使用maven编译java项目

我正在尝试在 java 16.0.1 上使用 maven 构建 IntelliJ 项目,但它无法编译我的项目,尽管 IntelliJ 能够成功完成。在此之前,我使用maven编译了一个java 15项目,但我决定将所有内容更新到16.0.1,因为我的机器上不同版本的java完全混乱,就像我能够编译但不能运行生成的.jar文件一样等等
mvn compile输出:

[ERROR] Error executing Maven.
[ERROR] java.lang.IllegalStateException: Unable to load cache item
[ERROR] Caused by: Unable to load cache item
[ERROR] Caused by: Could not initialize class com.google.inject.internal.cglib.core.$MethodWrapper
Run Code Online (Sandbox Code Playgroud)

这是我的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>org.example</groupId>
    <artifactId>TaxiDB</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <mainClass>Main</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <release>16.0.1</release>
                </configuration>
            </plugin>
        </plugins> …
Run Code Online (Sandbox Code Playgroud)

java ubuntu compiler-errors maven maven-compiler-plugin

15
推荐指数
1
解决办法
1万
查看次数