我有两个项目。一个如下(例如项目1):
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.3.RELEASE</version>
<relativePath/>
</parent>
和第二个(例如项目2)如下:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.BUILD-SNAPSHOT</version>
<relativePath/>
</parent>
都有这个:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
好吧,项目1运行良好。我可以在.m2 repo文件夹中看到Spring插件v。2.0.0.build-snapshot。
项目2正在抛出以下错误:
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call the method org.springframework.plugin.core.PluginRegistry.getPluginFor(Ljava/lang/Object;Lorg/springframework/plugin/core/Plugin;)Lorg/springframework/plugin/core/Plugin; but it does not exist. Its class, org.springframework.plugin.core.PluginRegistry, is available from the following locations:
jar:file:/.../.m2/repository/org/springframework/plugin/spring-plugin-core/2.0.0.BUILD-SNAPSHOT/spring-plugin-core-2.0.0.BUILD-SNAPSHOT.jar!/org/springframework/plugin/core/PluginRegistry.class
It was loaded from the following location:
file:/.../.m2/repository/org/springframework/plugin/spring-plugin-core/2.0.0.BUILD-SNAPSHOT/spring-plugin-core-2.0.0.BUILD-SNAPSHOT.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of org.springframework.plugin.core.PluginRegistry
当我尝试强制版本以在Project 2 POM中使用Maven插件时,我看到经典的黄色警告说,我要覆盖托管版本2.2.0.build-snapshot,但Maven插件没有2.2.0版本。
奇怪的是,我能够直到昨天运行这个项目。
有人可以告诉我出了什么问题吗?
注意:当我降级项目2至2.0.3.Release时,全部开始工作。
当我们使用项目中的任何依赖关系(除了提供的弹簧启动以外)时,我们需要提供春季交易核心插件来解决此问题。
请尝试以下依赖关系,并且版本与您的Spring Boot版本兼容。
春季交易核心依赖性:
<dependency>
<groupId>org.springframework.plugin</groupId>
<artifactId>spring-plugin-core</artifactId>
<version>1.2.0.RELEASE</version>
</dependency>
解决此问题的解决方案很简单,您将在依赖关系部分中导入 Spring Boot Data REST启动器依赖关系。只需删除它。一切都会好起来,绝对完美。谢谢!