找不到Spring Boot模块错误 [英] Spring Boot module not found error

查看:181
本文介绍了找不到Spring Boot模块错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Java 9上创建Spring Boot应用程序.如果我在pom.xml中按如下所示保留父项:

I am creating a Spring Boot application on Java 9. If I keep parent as below in pom.xml:

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.1.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
</parent>

module-info.java为:

module com.journaldev.spring.SpringWebflux {
    requires reactor.core;
    requires spring.web;
    requires spring.context;
    requires spring.webflux;
    requires spring.boot;
    requires spring.boot.autoconfigure;
}

然后由于找不到模块而出现错误.

Then I get errors as module not found.

module-info.java:[2,21] module not found: reactor.core
module-info.java:[3,20] module not found: spring.web
module-info.java:[4,20] module not found: spring.context
module-info.java:[5,20] module not found: spring.webflux
module-info.java:[6,20] module not found: spring.boot
module-info.java:[7,25] module not found: spring.boot.autoconfigure

如果我将spring-boot-starter-parent版本降低到2.0.0.RELEASE,则此错误消失了.我想了解为什么?

If I lower the spring-boot-starter-parent version to 2.0.0.RELEASE then this error is gone. I am trying to understand why?

推荐答案

如注释中所述,该jar文件已损坏(当您升级到较新版本时,可能会发生这种情况,而在网络级别则发生了一些问题).通常,从Maven或Gradle缓存中清除该漏洞就可以解决该问题.

As discussed in the comments, the jar was corrupted (which can happen when you upgrade to a newer version and something wrong happened at network level). Clearing that from the maven or gradle cache is usually enough to get rid of the problem.

这篇关于找不到Spring Boot模块错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆