javatestingmockitospring-testeclipse-photon

Eclipse Photon does not resolve imports in test sources


I have moved to Eclipse Photon with an existing workspace. I have some Maven projects in this workspace. All projects did not have any errors in Eclipse Oxygen. After opening my workspace in Eclipse Photon all test-classes which import org.mockito.Mockito, org.springframework.mock and org.springframework.test have errors. These imports cannot be resolved though Eclipse is aware of them as I can jump into the classes.

Why can Eclipse Photon not resolve these imports? And how can I fix this?


Solution

  • If this is really a maven project and you are using matching m2e-version 1.9, it should automatically configure the "Contains test sources."-setting and the related settings correctly.

    You may have to update the project classpath by right-clicking on the project and Choosing "Maven" > "Update Project"