【发布时间】:2019-07-12 22:29:19
【问题描述】:
我有两个项目。如下之一(比如项目 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 存储库文件夹中看到 Spring Plugin 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
当我尝试在项目 2 POM 中强制使用 Maven 插件版本时,我看到经典的黄色警告,说我正在覆盖托管版本 2.2.0.BUILD-SNAPSHOT,但 Maven 插件没有 2.2.0 版本。
奇怪的是,我能运行这个项目直到昨天......
谁能告诉我出了什么问题?
注意:当我将项目 2 降级到 2.0.3.RELEASE 时,一切都开始工作了。
【问题讨论】:
-
您使用
-SNAPSHOT版本有什么原因吗? -
其实没有原因。我必须使用 v2.1.3 吗?
-
我会使用发布版本而不是
-SNAPSHOT,只有当你尝试特殊的东西时。所以我建议使用最新的发布版本,即 2.1.3 -
如果是这样,我必须认为这是一个冷案。你统治!
-
也许我误解了你的回答。如果不升级,这取决于您是否必须坚持使用 2.0.X 线...
标签: maven spring-boot