Adding Maven into Eclipse Projects


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:

  1. Select Help > Install New Software. This should display the “Install” dialog.
  2. 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.
  3. Choose the component listed under m2eclipse: “Maven Integration for Eclipse (Required)”.
  4. Click Next. Eclipse will then check to see if there are any issues which would prevent a successful installation.
  5. Click Next and agree to the terms of the Eclipse Public License v1.0.
  6. Click Finish to begin the installation process. Eclipse will then download and install the necessary components.
  7. 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.

 

 

 

About these ads

About cgrant

Christopher Grant is an IT professional with and MBA and over 15 years experience developing technology based business solutions. His work with small business and large corporations includes leading development efforts in a wide variety of domains ranging from internal business systems to externally facing eCommerce systems. View all posts by cgrant

3 Responses to “Adding Maven into Eclipse Projects”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: