To take full advantage of a Maven-based project from within Eclipse, you should install the Maven plugin according to these steps. Please note that you must be using Eclipse 3.5 or newer.
For more information about Maven, see:
- From the Eclipse menu, choose Help › Install New Software…
- Click the Add button to add an update site:
- Name: m2eclipse
- Location: http://m2eclipse.sonatype.org/sites/m2e
- Click OK
- Check the item that appears—Maven Integration for Eclipse—and click Next.
- Click Next again, accept the license terms, and click Finish.
- Restart Eclipse.
Configure Eclipse (Windows only)
On Windows, you will need to configure Eclipse to use the Java Development Kit (JDK).
First, download and install JDK 6 from the Java website.
Take note of where the Java installation ended up; we will use “C:\Program Files\Java\jdk1.6.0_20” below, though your path is likely to be different.
Also take note of the path to your Eclipse installation; we will use “C:\Users\you\Programs\eclipse” though your path is likely to be different.
Open the file “C:\Users\you\Programs\eclipse\eclipse.ini” in a text editor, and follow these instructions to specify the JVM using the “-vm” flag. Be careful to follow the instructions exactly.
Now update Eclipse’s JRE to be JDK-aware:
- Launch Eclipse
- From the menu choose Window › Preferences
- Select Java › Installed JREs
- Click Search…, navigate to “C:\Program Files\Java\jdk1.6.0_20” and click OK
- Check the box next to the JDK that appears and click OK
On macOS, behind a firewall
I (Jean-Yves speaking) noticed a very annoying problem. At work, I live behind a firewall, and whatever I did, the version of maven shipped with Eclipse (Indigo or Juno) never managed to reach out the outside world (even tweaking proxy configuration). This resulted in the impossibility to import any maven project.
One solution that worked for me was to configure Eclipse not to use the maven version it shipped. Instead, I used the one shipped with fink accessible from the command line, and with a system proxy configured correctly.