简体   繁体   English

Intellij 多模块项目 - 找不到符号

[英]Intellij multi-module project - Cannot find symbol

I am working on a project which has multiple modules like client, common, server.我正在开发一个项目,该项目具有多个模块,如客户端、通用、服务器。 In the server module of the project I have a service which is referencing to a new class I created in the common module.在项目的服务器模块中,我有一个服务,它引用了我在公共模块中创建的新类。 For some reason, when I run the project locally, I repeatedly get this error ->由于某种原因,当我在本地运行项目时,我反复收到此错误 ->

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin ....   cannot find symbol 
[ERROR] symbol : class Document

for the new Document class I added in the common module.对于我在 common 模块中添加的新 Document 类。

When I Build -> Rebuild my common module and server module again, the error goes away.当我构建 -> 再次重建我的通用模块和服务器模块时,错误消失了。 But when this happens, it fails during runtime with ClassNotFoundException I am running project with mvn spring-boot:run command但是当发生这种情况时,它在运行时失败并出现 ClassNotFoundException 我正在使用 mvn spring-boot:run 命令运行项目

Is there a permanent fix for this?是否有永久修复此问题?

I think I need to fix the structure of project or add the right dependency in the settings.我想我需要修复项目的结构或在设置中添加正确的依赖项。

I ran mvn install for the common module and it fixed all problems.我为通用模块运行了 mvn install 并解决了所有问题。 Thanks.谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM