Maven and Eclipse, Top Eclipse Kepler Feature #5

Maven and Eclipse, Top Eclipse Kepler Feature #5

The Eclipse Kepler release is just over 1 week away, and to help celebrate the release I’m counting down the Top 10 Kepler Features I’m most excited about. Number 5 on my list is the much improved integration between Maven and Eclipse.

Integrating Maven based builds into Eclipse is not easy. This is because both Maven and Eclipse control the build process in fundamentally different ways. Eclipse uses an incremental compiler which runs each time a file is saved. Maven on the other hand is a very powerful build tool based on a variety of plug-ins and build phases. The M2E project was started to help bridge this gap. To get tight integration between Maven and Eclipse, M2E relies on ‘connectors‘, highly specialized tools which bridge the disconnect between Maven plug-ins and Eclipse.

m2e-wtp_logo_200px

With Kepler, the M2E-WTP project has reached its 1.0 release. M2E-WTP delivers a number of Maven-2-Eclipse connectors for use with the Web Tools Project and is one of the most downloaded Eclipse plug-ins with over 20,000 installs per month.

M2E-WTP has support for converting Eclipse projects to Maven JavaEE projects.

Screen Shot 2013-06-17 at 12.17.50 PM

Screen Shot 2013-06-17 at 12.19.04 PM

M2E provides dependency management support, and if you choose to download the Maven Central Index, you can search for dependencies right from your IDE:

Screen Shot 2013-06-17 at 12.31.50 PM

And with WTP’s hot-deployment and M2E-WTP, you can experience continuous deployment as your work.

Screen Shot 2013-06-17 at 12.41.40 PM

M2E-WTP also supports Dynamic Web-Resource Filtering. With this feature, you can add parameters to your source and configuration files. Whenever they are saved the plug-in is triggered. In this example, as you change your profile from “Production” to “Staging”, the Eclipse version dynamically changes from “Kepler” to “Luna”.

Screen Shot 2013-06-17 at 12.51.15 PM

M2E-WTP also supports WAR overlay, allowing you to share resources by overlaying them at build time. For example, you can overlay the Jenkins war in your own project.

Screen Shot 2013-06-17 at 1.01.32 PM

And finally, there are a number of other optional connectors you can install for things like JAX-RS, JPA and JSF. These are all available in the Eclipse Kepler repository.

Screen Shot 2013-06-17 at 1.06.09 PM

[ Find more build tools and other goodies at our Eclipse Tools page. | Managing your Eclipse workspaces is easier with Yoxos. Get Yoxos now. ]

A big thanks to Fred Bricon for all his hard work on M2E-WTP and for helping me with the details.

For my Eclipse Top 10 and other Eclipse Tips & Tricks, follow me on Twitter.

6 Comments
  • Scott Carey
    Reply
    Posted at 11:31 pm, June 18, 2013

    The connector architecture is fundamentally flawed. Eclipse is asking EVERY plugin author to create a connector, or become popular enough to get the eclipse developers to make one. Many that I use are still not on the radar and I have to configure m2e exceptions.

    Try and create your own maven plugin using eclipse in project A and use it in project B. M2E complains, and fails to use it (requiring an exception), even for trivial plugins that are obviously safe or use facilities that Eclipse can handle (such as adding a source directory).

    Requiring a connector for every plugin out there is a huge problem. Eclipse can never hope to keep up with every plugin in the universe, or expect the universe to to learn how to use P2/Osgi to push connectors.

    Eclipse still has no notion of different classloader scopes for a single project (primarily, test vs compile scope), and additionally still does not support nesting of projects. These require bigger changes in eclipse, but there seems to be no momentum to improve Java on eclipse other than ‘in place’ features such as more compiler static analysis, refactorings, and quick-fixes.

    That said, using Eclipse with M2E is still better than almost any other way of using eclipse, if you can tolerate it taking more than a minute to close eclipse. Maven dependency management features and ‘free’ downloading of javadoc and source for your libraries, making them available in your IDE without any effort, is pure awesome compared to ‘naked’ eclipse.

  • Eyal
    Reply
    Posted at 9:49 pm, June 19, 2013

    I hope this means that the Maven-Scala-Eclipse integration will get better. Our dev team was working almost entirely in Eclipse until we started integrating Scala into our server.

  • Liam Coughlin
    Reply
    Posted at 3:57 pm, June 26, 2013

    Hello Ian

    I have a lot of the same issues Scott Carey does, and the last paragraph of your answer hit’s the nail on the head. Dropping eclipse custom builders for maven would likely be a huge step forward for a wide variety of reasons. It’s not that maven is a perfect tool — far from it, but it is the defacto-standard and the most effective build system available. I’m also of the opinion that having that level of pressure on the maven project would also serve to improve maven itself, so it would ultimately result in a big win for everyone.

  • Sundar K Iyengar
    Reply
    Posted at 12:38 pm, July 2, 2013

    How do you choose to download maven central index?

  • jack holt
    Reply
    Posted at 3:51 pm, July 3, 2013

    My work requires nested maven modules (something maven on its own supports fine). I still use 0.10 of m2e because that was the last version that supported it.

Post a Comment

Comment
Name
Email
Website