This is an archive of the old MediaWiki-based ImageJ wiki. The current website can be found at imagej.net.

Using Maven with Eclipse

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:


Install m2eclipse

Note: if you use Eclipse 3.7 Indigo or newer, you most likely have m2e already. If your File  › Import offers you a Maven section, you have it, and can skip the rest of this section.

  • From the Eclipse menu, choose Help  › Install New Software...
  • Click the Add button to add an update site:
  • 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 web site.

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


Troubleshooting

On Mac OS X, 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 no 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.