Spring Boot module not found error

流过昼夜 提交于 2019-12-11 15:06:30

问题


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>

and module-info.java as:

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

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?


回答1:


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.



来源:https://stackoverflow.com/questions/50196952/spring-boot-module-not-found-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!