Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Select Window >  Preferences. In the search box enter organize imports.
  2.  Select Java > Code Style > Organize Imports.
    The result is as following:
  3. Make sure the order of the import groups is as what you see above (java, javax, org, com).
    It is the Eclipse default, so you might not have to change anything.
  4. Check both Number of imports needed for * and Number of static imports needed for * are set to 99.  
    The numbers need to be high enough so that Eclipse will not replace your imports with the so called "star imports" using *. 99 is the default value for Eclipse and is usually high enough.
  5. Select the Do not create imports for types starting with a lowercase letter checkbox.
  6. Select Apply and Close.
    Now you can let Eclipse format and remove unused imports with the shortcut:
    Ctrl+Shift+O (Command+Shift+O on Mac)
Note
Important: Please apply this command to clean up your imports before you create a pull request on Github since the imports are not cleaned up by the maven formatter plugin we use when you run the build command !

...

  1. Select Window > Preferences.
  2. In the search box, enter maven.
  3. Select Download Artifact Sources and Download Artifact JavaDoc.
  4. Select Apply and Close.
    Now you’ve completed the setup for Eclipse.

To learn more about Eclipse go to: How to Set Up and Use Eclipse.