java.lang.UnsupportedClassVersionError: org/springframework/boot/maven/RepackageMojo has been compil

文章目录

      • 场景
      • 解决

场景

打包报错:java.lang.UnsupportedClassVersionError: org/springframework/boot/maven/RepackageMojo has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0

解决

spring-boot-maven-plugin 指定版本, 版本和springboot报错一致, 最新版不支持repackage 配置

    <build>
        <finalName>${artifactId}finalName>
        <plugins>
            
            <plugin>
                <groupId>org.apache.maven.pluginsgroupId>
                <artifactId>maven-compiler-pluginartifactId>
                <configuration>
                    <source>8source>
                    <target>8target>
                    <encoding>utf-8encoding>
                configuration>
            plugin>
            
            <plugin>
                <groupId>org.springframework.bootgroupId>
                <artifactId>spring-boot-maven-pluginartifactId>
                <version>2.2.4.RELEASEversion>
                
                <executions>
                    <execution>
                        <goals>
                            <goal>repackagegoal> 
                        goals>
                    execution>
                executions>
            plugin>
        plugins>
    build>

你可能感兴趣的:(java,maven,spring,boot)