我有两个项目。如下(例如项目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 Plugin 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
当我尝试在项目2 POM中将版本强制为Maven插件时,我看到经典的黄色警告说我正在覆盖托管版本2.2.0.BUILD-SNAPSHOT,但Maven插件没有2.2.0版本。
奇怪的是,我能够运行这个项目直到昨天。...
有人可以告诉我怎么了吗?
注意:当我将项目2降级到2.0.3.RELEASE时,一切都开始工作。
答案 0 :(得分:1)
当我们在项目中使用任何依赖项(提供的Spring Boot除外)时,我们需要提供spring transaction core插件来解决此问题。
请尝试以下依赖项,并且版本与您的Spring Boot版本兼容。
Spring事务核心依赖性:
<dependency>
<groupId>org.springframework.plugin</groupId>
<artifactId>spring-plugin-core</artifactId>
<version>1.2.0.RELEASE</version>
</dependency>
答案 1 :(得分:0)
此问题的解决方案很简单,您将在依赖项部分中导入 Spring Boot Data REST Starter 依赖项。只需将其删除。一切都会正常并且绝对完美。谢谢!