【BUG】Failed_to_execute_goal_org.springframework

简介: 【BUG】Failed_to_execute_goal_org.springframework


报错内容

Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.1.1.RELEASE:repackage (default) on project leader-admin: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:2.1.1.RELEASE:repackage failed: Unsupported class file major version 65

原因分析

这个错误是由于您的项目中使用了一个类文件版本为65.0的类,而当前的Java运行时环境不支持该版本。

根据错误信息,您正在使用的是Spring Boot Maven插件,版本为2.1.1.RELEASE。该插件的默认目标是将项目打包为可执行的JAR文件。

要解决这个问题,您可以尝试以下几个步骤:

  1. 确认您使用的Java版本是否与该插件兼容。您可以查看Spring Boot官方文档或插件的文档,了解其兼容的Java版本范围。
  2. 确保您的项目中使用的所有依赖项(包括Spring Boot和其他库)的版本与您的Java版本兼容。您可以查看它们的文档或发布说明,了解其兼容的Java版本要求。

如果您的Java版本较低,并且您无法升级到支持类文件版本65.0的Java版本,您可以尝试降低您的项目中的类文件版本。您可以在项目的pom.xml文件中配置maven-compiler-plugin插件,指定目标类文件版本。例如,您可以将目标版本设置为61.0,以与Java 17兼容。

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <target>17</target>
                <source>17</source>
            </configuration>
        </plugin>
    </plugins>
</build>

请根据您的实际情况进行调整。

解决方案

替换为 3.1.3

<plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>3.1.3</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>


相关文章
|
4月前
|
SQL Java 数据库
flyway报错Caused by: org.flywaydb.core.api.FlywayException: Validate failed: Detected failed migration
flyway报错Caused by: org.flywaydb.core.api.FlywayException: Validate failed: Detected failed migration
62 1
|
3月前
|
Java Spring
【亲测有效完结bug】org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exce
【亲测有效完结bug】org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exce
428 0
|
8月前
|
Java 数据库连接 mybatis
解决Error querying database. Cause: org.apache.ibatis.executor.ExecutorException: No constructor found
解决Error querying database. Cause: org.apache.ibatis.executor.ExecutorException: No constructor found
360 1
|
5月前
|
Java Maven
Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
105 0
|
7月前
|
Java Maven
Maven运行builder出现Failed to execute goal on projectXXXXX错误
Maven运行builder出现Failed to execute goal on projectXXXXX错误
191 7
|
SQL
报错org.springframework.jdbc.UncategorizedSQLException: Error attempting to get column ‘xxx‘ from resu
报错org.springframework.jdbc.UncategorizedSQLException: Error attempting to get column ‘xxx‘ from resu
476 0
报错org.springframework.jdbc.UncategorizedSQLException: Error attempting to get column ‘xxx‘ from resu
|
Java Apache Maven
【异常解决】Handler dispatch failed;nested exception is java.lang.NoClassDefFoundError: org/apache/common
【异常解决】Handler dispatch failed;nested exception is java.lang.NoClassDefFoundError: org/apache/common
4222 0
|
8月前
|
前端开发 Java 数据库连接
若依 mybatis报错nested exception is org.apache.ibatis.binding.BindingException: Parameter ‘XXX‘ 错误
若依 mybatis报错nested exception is org.apache.ibatis.binding.BindingException: Parameter ‘XXX‘ 错误
163 0
|
8月前
|
Java
org.springframework.web.util.NestedServletException: Request processing failed; nested exception....
org.springframework.web.util.NestedServletException: Request processing failed; nested exception....
192 0
Caused by: org.springframework.context.ApplicationContextException: Unable to start ServletWebServer
Caused by: org.springframework.context.ApplicationContextException: Unable to start ServletWebServer