IDE中使用package打包出现java.lang.TypeNotPresentException: Type org.springframework.boot.maven.RepackageMoj
场景
后台框架:springcloud,开发工具:Idea,仓库:maven
描述:在项目中使用package 对项目进行打包时抛出异常,具体信息如下:
[INFO]--- spring-boot-maven-plugin:3.0.0:repackage (default) @ ex-flow-business ---[WARNING]Error injecting:org.springframework.boot.maven.RepackageMojojava.lang.TypeNotPresentException:Typeorg.springframework.boot.maven.RepackageMojo not present
at org.eclipse.sisu.space.URLClassSpace.loadClass(URLClassSpace.java:147)
at org.eclipse.sisu.space.NamedClass.load(NamedClass.java:46)
at org.eclipse.sisu.space.AbstractDeferredClass.get(AbstractDeferredClass.java:48)
at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:81)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:53)
at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:65)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:115)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:133)
at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:68)
at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:63)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:45)
at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012)
at org.eclipse.sisu.inject.Guice4$1.get(Guice4.java:162)
at org.eclipse.sisu.inject.LazyBeanEntry.getValue(LazyBeanEntry.java:81)
at org.eclipse.sisu.plexus.LazyPlexusBean.getValue(LazyPlexusBean.java:51)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:263)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:255)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:519)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:121)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
at org.codehaus.classworlds.Launcher.main(Launcher.java:47)Caused by:java.lang.UnsupportedClassVersionError: org/springframework/boot/maven/RepackageMojo has been compiled by a more recent version of the JavaRuntime(class file version 61.0),this version of the JavaRuntime only recognizes class file versions up to52.0
at java.lang.ClassLoader.defineClass1(NativeMethod)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:473)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(NativeMethod)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:401)
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
at org.eclipse.sisu.space.URLClassSpace.loadClass(URLClassSpace.java:139)...42 more
[INFO]------------------------------------------------------------------------[INFO]BUILDFAILURE[INFO]------------------------------------------------------------------------[INFO]Total time:19.423 s
[INFO]Finished at:2022-11-25T20:03:09+08:00[INFO]FinalMemory:82M/855M
[INFO]------------------------------------------------------------------------[ERROR]Failedtoexecute goal org.springframework.boot:spring-boot-maven-plugin:3.0.0:repackage (default) on project ex-flow-business:Executiondefault of goal org.springframework.boot:spring-boot-maven-plugin:3.0.0:repackage failed:Unabletoload the mojo 'repackage' in the plugin 'org.springframework.boot:spring-boot-maven-plugin:3.0.0' due toanAPI incompatibility:org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/springframework/boot/maven/RepackageMojo has been compiled by a more recent version of the JavaRuntime(class file version 61.0),this version of the JavaRuntime only recognizes class file versions up to52.0[ERROR]-----------------------------------------------------[ERROR] realm = plugin>org.springframework.boot:spring-boot-maven-plugin:3.0.0[ERROR] strategy =org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy[ERROR] urls[0]= file:/D:/tools/maven/repository/org/springframework/boot/spring-boot-maven-plugin/3.0.0/spring-boot-maven-plugin-3.0.0.jar
[ERROR] urls[1]= file:/D:/tools/maven/repository/org/springframework/spring-context/6.0.2/spring-context-6.0.2.jar
[ERROR] urls[2]= file:/D:/tools/maven/repository/org/springframework/spring-aop/6.0.2/spring-aop-6.0.2.jar
[ERROR] urls[3]= file:/D:/tools/maven/repository/org/springframework/spring-beans/6.0.2/spring-beans-6.0.2.jar
[ERROR] urls[4]= file:/D:/tools/maven/repository/org/springframework/spring-core/6.0.2/spring-core-6.0.2.jar
[ERROR] urls[5]= file:/D:/tools/maven/repository/org/springframework/spring-jcl/6.0.2/spring-jcl-6.0.2.jar
[ERROR] urls[6]= file:/D:/tools/maven/repository/org/springframework/spring-expression/6.0.2/spring-expression-6.0.2.jar
[ERROR] urls[7]= file:/D:/tools/maven/repository/org/springframework/boot/spring-boot-buildpack-platform/3.0.0/spring-boot-buildpack-platform-3.0.0.jar
[ERROR] urls[8]= file:/D:/tools/maven/repository/com/fasterxml/jackson/core/jackson-databind/2.14.1/jackson-databind-2.14.1.jar
[ERROR] urls[9]= file:/D:/tools/maven/repository/com/fasterxml/jackson/core/jackson-annotations/2.14.1/jackson-annotations-2.14.1.jar
[ERROR] urls[10]= file:/D:/tools/maven/repository/com/fasterxml/jackson/core/jackson-core/2.14.1/jackson-core-2.14.1.jar
[ERROR] urls[11]= file:/D:/tools/maven/repository/com/fasterxml/jackson/module/jackson-module-parameter-names/2.14.1/jackson-module-parameter-names-2.14.1.jar
[ERROR] urls[12]= file:/D:/tools/maven/repository/net/java/dev/jna/jna-platform/5.7.0/jna-platform-5.7.0.jar
[ERROR] urls[13]= file:/D:/tools/maven/repository/net/java/dev/jna/jna/5.7.0/jna-5.7.0.jar
[ERROR] urls[14]= file:/D:/tools/maven/repository/org/apache/commons/commons-compress/1.21/commons-compress-1.21.jar
[ERROR] urls[15]= file:/D:/tools/maven/repository/org/apache/httpcomponents/httpclient/4.5.13/httpclient-4.5.13.jar
[ERROR] urls[16]= file:/D:/tools/maven/repository/org/apache/httpcomponents/httpcore/4.4.13/httpcore-4.4.13.jar
[ERROR] urls[17]= file:/D:/tools/maven/repository/commons-codec/commons-codec/1.11/commons-codec-1.11.jar
[ERROR] urls[18]= file:/D:/tools/maven/repository/org/tomlj/tomlj/1.0.0/tomlj-1.0.0.jar
[ERROR] urls[19]= file:/D:/tools/maven/repository/org/antlr/antlr4-runtime/4.7.2/antlr4-runtime-4.7.2.jar
[ERROR] urls[20]= file:/D:/tools/maven/repository/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar
[ERROR] urls[21]= file:/D:/tools/maven/repository/org/springframework/boot/spring-boot-loader-tools/3.0.0/spring-boot-loader-tools-3.0.0.jar
[ERROR] urls[22]= file:/D:/tools/maven/repository/org/sonatype/plexus/plexus-build-api/0.0.7/plexus-build-api-0.0.7.jar
[ERROR] urls[23]= file:/D:/tools/maven/repository/org/codehaus/plexus/plexus-utils/1.5.8/plexus-utils-1.5.8.jar
[ERROR] urls[24]= file:/D:/tools/maven/repository/org/apache/maven/plugins/maven-shade-plugin/3.2.4/maven-shade-plugin-3.2.4.jar
[ERROR] urls[25]= file:/D:/tools/maven/repository/org/sonatype/sisu/sisu-inject-bean/1.4.2/sisu-inject-bean-1.4.2.jar
[ERROR] urls[26]= file:/D:/tools/maven/repository/org/sonatype/sisu/sisu-guice/2.1.7/sisu-guice-2.1.7-noaop.jar
[ERROR] urls[27]= file:/D:/tools/maven/repository/org/apache/maven/maven-aether-provider/3.0/maven-aether-provider-3.0.jar
[ERROR] urls[28]= file:/D:/tools/maven/repository/org/sonatype/aether/aether-util/1.7/aether-util-1.7.jar
[ERROR] urls[29]= file:/D:/tools/maven/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
[ERROR] urls[30]= file:/D:/tools/maven/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[31]= file:/D:/tools/maven/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[32]= file:/D:/tools/maven/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[33]= file:/D:/tools/maven/repository/org/apache/maven/shared/maven-artifact-transfer/0.12.0/maven-artifact-transfer-0.12.0.jar
[ERROR] urls[34]= file:/D:/tools/maven/repository/org/apache/maven/shared/maven-common-artifact-filters/3.0.1/maven-common-artifact-filters-3.0.1.jar
[ERROR] urls[35]= file:/D:/tools/maven/repository/org/apache/maven/shared/maven-shared-utils/3.1.0/maven-shared-utils-3.1.0.jar
[ERROR] urls[36]= file:/D:/tools/maven/repository/org/ow2/asm/asm/8.0/asm-8.0.jar
[ERROR] urls[37]= file:/D:/tools/maven/repository/org/ow2/asm/asm-commons/8.0/asm-commons-8.0.jar
[ERROR] urls[38]= file:/D:/tools/maven/repository/org/ow2/asm/asm-tree/8.0/asm-tree-8.0.jar
[ERROR] urls[39]= file:/D:/tools/maven/repository/org/ow2/asm/asm-analysis/8.0/asm-analysis-8.0.jar
[ERROR] urls[40]= file:/D:/tools/maven/repository/org/jdom/jdom2/2.0.6/jdom2-2.0.6.jar
[ERROR] urls[41]= file:/D:/tools/maven/repository/org/apache/maven/shared/maven-dependency-tree/3.0.1/maven-dependency-tree-3.0.1.jar
[ERROR] urls[42]= file:/D:/tools/maven/repository/org/eclipse/aether/aether-util/0.9.0.M2/aether-util-0.9.0.M2.jar
[ERROR] urls[43]= file:/D:/tools/maven/repository/commons-io/commons-io/2.6/commons-io-2.6.jar
[ERROR] urls[44]= file:/D:/tools/maven/repository/org/vafer/jdependency/2.4.0/jdependency-2.4.0.jar
[ERROR] urls[45]= file:/D:/tools/maven/repository/org/ow2/asm/asm-util/8.0/asm-util-8.0.jar
[ERROR] urls[46]= file:/D:/tools/maven/repository/com/google/guava/guava/28.2-android/guava-28.2-android.jar
[ERROR] urls[47]= file:/D:/tools/maven/repository/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar
[ERROR] urls[48]= file:/D:/tools/maven/repository/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar
[ERROR] urls[49]= file:/D:/tools/maven/repository/org/checkerframework/checker-compat-qual/2.5.5/checker-compat-qual-2.5.5.jar
[ERROR] urls[50]= file:/D:/tools/maven/repository/com/google/errorprone/error_prone_annotations/2.3.4/error_prone_annotations-2.3.4.jar
[ERROR] urls[51]= file:/D:/tools/maven/repository/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar
[ERROR] urls[52]= file:/D:/tools/maven/repository/org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.jar
[ERROR]Number of foreign imports:1[ERROR]import:Entry[importfrom realm ClassRealm[maven.api, parent:null]][ERROR][ERROR]-----------------------------------------------------[ERROR][ERROR]->[Help1][ERROR][ERROR]To see the full stack trace of the errors, re-run Mavenwiththe-e switch.[ERROR]Re-run Maven using the -Xswitchtoenable full debug logging.[ERROR][ERROR]For more information about the errors and possible solutions, please read the following articles:[ERROR][Help1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException