I try to keep my examples simple and as close to core Java as possible. Typically I don’t require plugins or extended frameworks as they complicate the discussion. There ARE some core tools I do like to use and Maven is one of them. If you’re browsing any of my examples and come across a “pom.xml” file you’re looking at a project that utilizes maven. This short guide will walk you through adding maven to your eclipse install so you can run the samples at a minimum or better yet, use Maven in your own projects.What is maven?
Maven can do a lot of things, but I primarily use it for dependency management. That is to say, rather than copying all my jar files into various directories manually, dealing with issues on what version I’m supposed to be using, and trying to deal with compile classpath issues between systems, I use maven to deal with all that for me. In it’s simplest form Maven is a list of Jars that need to be included in included in the build. The tool uses local repository for subsequent builds, or downloads libs from external sources if it’s not found locally.
What is m2eclipse
m2eclipse is a plugin by Sonatype for eclipse that allows you to utilize the standard pom.xml config files within eclipse for dependency management. The tool also provides editors and wizards for managing your dependencies.
How to install it
Update Site: http://m2eclipse.sonatype.org/sites/m2e
To install this plugin in the Eclipse IDE:
- Select Help > Install New Software. This should display the “Install” dialog.
- Paste the Update Site URL into the field named “Work with:” and press Enter. Pressing Enter should cause Eclipse to update list of available plugins and components.
- Choose the component listed under m2eclipse: “Maven Integration for Eclipse (Required)”.
- Click Next. Eclipse will then check to see if there are any issues which would prevent a successful installation.
- Click Next and agree to the terms of the Eclipse Public License v1.0.
- Click Finish to begin the installation process. Eclipse will then download and install the necessary components.
- Once the installation process is finished, Eclipse will ask you if you want to restart the IDE. Sonatype strongly recommends that you restart your IDE after installing m2eclipse.