IntelliJ can't find depencency when compiling,

2019-08-10 12:04发布

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:

enter image description here

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

enter image description here

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

enter image description here

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条回答
等我变得足够好
2楼-- · 2019-08-10 13:05

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

查看更多
登录 后发表回答