小编Mau*_*cyt的帖子

Maven Surefire 测试失败:不支持的类文件主要版本 61

我正在尝试使用 Maven 在 IntelliJ 中创建一个项目,但是在运行时mvn installmvn test为了运行我编写的简单 JUnit 测试时,它失败并出现以下错误:

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project Idlearn: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test failed: Unsupported class file major version 61 -> [Help 1]

我的 pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project>
    <modelVersion>4.0.0</modelVersion>

    <groupId>mimuw</groupId>
    <artifactId>Idlearn</artifactId>
    <version>1</version>
    <name>Idlearn</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <!-- for platform independent encoding-->
        <junit.version>5.8.2</junit.version> <!-- the latest JUnit version -->
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>${junit.version}</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.22.2</version>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId> …
Run Code Online (Sandbox Code Playgroud)

java maven maven-surefire-plugin junit5

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

标签 统计

java ×1

junit5 ×1

maven ×1

maven-surefire-plugin ×1