Contents

Installing Eclipse and m2eclipse

Eclipse is the de facto IDE in Java land. Personally I am a BIG fan of Intellij IDEA, because it has a huge array of prepacked functionality that Eclipse doesn't have and that you need to install separately in Eclipse (and that generally doesn't work as nice as what Intellij has prepacked). BUT, nonetheless I am going to use Eclipse for this tutorial, because it is free and more widely used and I don't want to force you to buy an Intellij license just for the sake of this tutorial (although it would save you the act of pulling your hair out over some of Eclipse's buggy and poorly documented plugins).

It doens't matter which IDE you use for creating a Spring MVC application, so if you prefer a different IDE, by all means, use it.

Getting Eclipse 

Follow these steps to get and prepare Eclipse for development with Maven. Again, I am assuming you are using Windows, but don't worry if you don't. Eclipse is available for all operating systems.

  1. Go to http://www.eclipse.org/downloads/ and download a version of Eclipse for Java EE developers for your operating system. I am choosing the Windows 64-bit version. Note: make sure you have a 64 bit JDK and OS installed if you choose to download the 64-bit version or Eclipse won't start and present a "JNI shared library" error.
  2. Unpack your download in a convenient location, C:\Program Files\Eclipse for example.
  3. You may want to create a new shortcut to C:\Program Files\Eclipse\eclipse.exe in your start menu or on your desktop, so you can start Eclipse more easily.

Installing m2eclipse

Eclipse doesn't have Maven support on board, so you must install the m2eclipse plugin, which provides support for Maven.

  1. Go to http://www.eclipse.org/m2e/download/ and copy the update site location. This is probably http://download.eclipse.org/technology/m2e/releases or something similar.
  2. Open Eclipse and go to Help > Install New Software...
  3. In the Install window click the Add... button.

    Adding software to Eclipse
  4. In the Add Repository panel, type M2E (or a name of your own choosing) in the Name field and paste the update site location in the Location field. Click OK.

    Adding Maven Integration to Eclipse
  5. Eclipse will search the update location for software and find Maven Integration For Eclipse. Tick the checkbox and click next a few times to install the plugin.
  6. After the plugin has installed, go to Windows > Show View > Other....
  7. In the Show View panel, choose Maven > Maven Repositories and click ok. This will add an overview of the repositories that Maven knows in the Eclipse interface.

    Show view - eclipse 

    Eclipse Maven repositories 
  8. There is one more task we need to perform. We need to configure m2eclipse to use our previously installed version of Maven. 
    1. Go to Window > Preferences.
    2. In the Preferences window select Maven > Installations from the list on the left.
    3. On the right-hand side of the window click Add... and navigate to yoru Maven installation folder and click OK.
    4. Now, select the check box of your own Maven installation.

      Maven installations
        (I am forced to use an older version of Maven for compatibility with another project)