Maven Project in Eclipse `org.springframework cannot be resolved to a type` from target path
Asked Answered
D

1

1

I've rolled onto a maven project that when I run mvn clean install from command line builds and runs fine. I had this project displaying in Eclipse without errors earlier in the week before I hosed my system. This makes me think I have a configuration wrong and hoping someone can give me a sanity check.

Inside of Eclipse, I'm seeing reported errors related to org.springframework cannot be resolved to a type in files in paths like <project_path>/target/<project>-<version>/WEB-INF/... What is catching my eye is that path of target which is a derived folder.

Maven Dependencies Showing:

enter image description here

Facets Enabled:

enter image description here

Project Explorer View:

enter image description here

From the above screenshots, you can see that the related jar files are pulled properly from the maven dependencies. Any ideas on what I have misconfigured and why I'm seeing the errors from the target path?

Dewayne answered 27/7, 2017 at 17:11 Comment(2)
The build and WebContent folders indicates that you haven't properly imported maven project into eclipse. Delete project in eclipse, delete all folder beside src, import existing maven project into eclipse.Geocentric
@AleksandrM If you write that as an answer, I'll accept it. Solved the issue.Dewayne
G
1

The build and WebContent folders indicate that you haven't properly imported Maven project into the Eclipse, hence errors.

One of the way to fix this:

  • Delete project from the Eclipse.

  • Go to project folder and delete all not needed folders. (Leave src).

  • Go to Eclipse click File -> Import..., select Existing Maven Projects, select your project folder, Finish.

Geocentric answered 27/7, 2017 at 17:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.