After I have deleted Junit from the eclipse java build path it became apparent that I use old org.junit imports in some other java files. After fixing them the project compiles both in eclipse and maven.
Maven still found all the test classes but no tests in them. The fix for that was to include junit-jupiter-engine and junit-platform-launcher dependencies and maven-surefire-plugin.