Lukasz Lukasz - 3 months ago 25
Java Question

Wrong package name when using automatically added imports in Eclipse

I have several Maven projects converted into one Eclipse workspace. When I edit the code under Eclipse, I sometimes use CTRL+SHIFT+M combination of keys to automatically add imports to the classes from a project in my workspace. But somehow they are added like this:


while to real package I wanted to import is
This has to be some configuration in Eclipse to fix this but I'm confused. However, this issue is very annoying.


I've forgotten to mention that Eclipse files were generated using
mvn eclipse:eclipse

Under Eclipse project seems to be configured properly. Its source folders set like this:

  • src/test/java

  • src/test/resources

  • src/main/java

  • src/main/resources

And everything under Eclipse works properly except the situation when I press CTRL+SHIFT+M keys


The standard source folder for Java projects is


For imported maven projects, simply remove this folder from the list of source folders at the build path settigs. The correct source folder is