The import xxx cannot be resolved

Encountered an unresolved error, as shown, the package cannot be resolved


There are many possibilities to cause this error, my project is a maven project, and there are many dependencies in the project

The reason for my error is that the project where this pojo is located, I did not add a dependency on him, and added a dependency, as shown in the following figure


Refresh and it's fine, this is where I went wrong

I have also Baidu, which will lead to other possibilities of this kind of error. I will summarize here and hope to help students who encounter the same error.

1. Clean the project and recompile the project.
[Solution] Generally, you can use the menu project -> clean .. of eclipse/myeclipse to solve it. At the same time, it is best to select the Build Automatically option.

2. If there is no solution, don't worry, keep coming. Re-import the jar package.
[Solution] After right-clicking the project -> build path -> Confi g build path -> Librarie s-> rem ove, re-import.

3. The project has dependent projects and needs to re-import the dependent searchprojects.
[Solution] After right-clicking the project -> build path -> Config build path -> project -> remove, re-import.

4. The problem of the automatically compiled class folder path
[Solution] Right-click the project -> build path -> Config build path -> source-> There is a Default output file: option at the bottom of the dialog box, you can select the project and then eclipse/ The path of the compiled class file in myeclipse, the general web project path is {ProjectName}/web(WebRoot)/ WEB-INF /classes, and the non-web project is generally {ProjectName}/classes.

5. If the problem still exists, it exceeds the limit of this problem, which means that it may be an error caused by other problems.
[Solution] It's not actually a solution. What exactly caused the problem can be viewed by opening the Problems dialog window.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325789061&siteId=291194637