IntelliJ can't find depencency when compiling, but can in editor.

你说的曾经没有我的故事 提交于 2019-12-11 13:53:32

问题


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:

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.


回答1:


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).



来源:https://stackoverflow.com/questions/34757159/intellij-cant-find-depencency-when-compiling-but-can-in-editor

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