I solved it and want to share my results.
The build path properties in eclipse photon have a new option in the source tab: Contains test sources. This option was set to No for the folder myproject/src/test/java
. When I tried to set it to Yes I got the following error:
The source folder 'src/testjava' in project 'myproject' must have an
output folder that is not also used for main sources
The error was shown although the output folder was already set to a different path than that of myproject/src/main/java
. To reset the settings I unchecked the option Allow outoput folders for source folders and set all output folders again. After that I was able to set the mentioned option to Yes. As the result of it the imports got resolved.
The reason is described here (scroll down there to Test sources). It says:
For each project, compilation is now done in two phases: First all
main sources (which cannot see any test-code on the build-path) and
then all test sources.
Since the option wasn't set for the test-source-folder it was compiled like a main-source-folder. Therefore the imports of test classes from dependencies with scope test could not be resolved.