但可以在编辑器中找到

但可以在编辑器中找到

本文介绍了IntelliJ在编译时找不到依赖关系,但可以在编辑器中找到。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Java IntelliJ项目中,我可以加载源代码和依赖关系,甚至可以转到 - >声明如下:

In my Java IntelliJ project, I am able to load the source code and dependencies and I am able to even Go To --> Declaration like this:

但是,当编译时,它找不到源代码!

However, when it comes time to compile, it cannot find the source code behind it!

我相当确定我正确设置了我的依赖:

And I am fairly sure I set up my dependencies properly:

所以我不明白为什么IntellJ会吐出这些错误。这个项目在Eclipse中工作得很好,但我正在寻找开始远离日食。

So I am failing to understand why IntellJ is spitting out those errors. This project works just fine in Eclipse, but I am looking to start moving away from eclipse.

推荐答案

您已经添加了一个文件夹,用于依赖(不是jar或模块),其中包含源代码和编译类。这是完全合法的,显然IDEA设法识别源文件夹,但是对于类文件夹却失败。

You had added a folder for dependency (not a jar or module) with sources and compiled classes in it. This is perfectly legal and obviously IDEA managed to recognize the source folder but failed for the classes folder.

按照您选择的依赖项(绿色铅笔图标)按编辑。打开的对话框显示类和源文件夹。添加类和包所在的确切文件夹(而不是根项目文件夹)。

Press "Edit" on your selected dependency (the green pencil icon). The dialog that opens show "Classes" and "Sources" folders. Add the exact folder in which the classes and packages are (not the root project folder).

这篇关于IntelliJ在编译时找不到依赖关系,但可以在编辑器中找到。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-03 22:09