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.
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.
- 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.
- Unpack your download in a convenient location, C:\Program Files\Eclipse for example.
- 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.
Eclipse doesn't have Maven support on board, so you must install the m2eclipse plugin, which provides support for Maven.
- 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.
- Open Eclipse and go to Help > Install New Software...
- In the Install window click the Add... button.
- 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.
- 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.
- After the plugin has installed, go to Windows > Show View > Other....
- 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
- There is one more task we need to perform. We need to configure m2eclipse to use our previously installed version of Maven.
- Go to Window > Preferences.
- In the Preferences window select Maven > Installations from the list on the left.
- On the right-hand side of the window click Add... and navigate to yoru Maven installation folder and click OK.
- Now, select the check box of your own Maven installation.
(I am forced to use an older version of Maven for compatibility with another project)