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 Maven and Eclipse, Top Eclipse Kepler Feature #5

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 Maven and Eclipse, Top Eclipse Kepler Feature #5

Screen Shot 2013 06 17 at 12.19.04 PM Maven and Eclipse, Top Eclipse Kepler Feature #5

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 Maven and Eclipse, Top Eclipse Kepler Feature #5

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 Maven and Eclipse, Top Eclipse Kepler Feature #5

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 <webResources> 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 Maven and Eclipse, Top Eclipse Kepler Feature #5

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 Maven and Eclipse, Top Eclipse Kepler Feature #5

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 Maven and Eclipse, Top Eclipse Kepler Feature #5

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 Responses to “Maven and Eclipse, Top Eclipse Kepler Feature #5”

  1. Scott Carey says:

    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.

  2. Ian Bull says:

    Hi Scott, thanks for the comment.

    I completely see your point about the connector architecture, and the hope that everyone will create M2E plugins is likely a lost battle. I’m very happy to see that WebTools now has connectors for common things, but I understand that that’s not enough.

    I’m wondering if you have other ideas how to improve the situation? Is the problem isolated to the Java Tooling (improve the JDT for different classloader scopes & nesting or projects), or is the problem up and down the entire Eclipse stack (builders, markers, resources, etc…)? Do you think there is a path forward by disabling all the Eclipse builders and simply letting Maven handle everything, or would this result too many other problems?

    For years Eclipse used a custom build technology (mainly because when Eclipse started Maven wasn’t around). The Eclipse platform is now moving towards Maven for its builds, and I think having a better Maven / Eclipse story would be “a good thing”.

  3. Eyal says:

    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.

  4. Liam Coughlin says:

    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.

  5. Sundar K Iyengar says:

    How do you choose to download maven central index?

  6. jack holt says:

    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.

6 responses so far

Written by . Published in Categories: EclipseSource News, Editors choice, Planet Eclipse