Historically, its been a major hassle for our team to import our multi-module Maven project into Eclipse given all the Flex, WTP, and GWT stuff in there. We were recently thinking that the maven-eclipse-plugin could help us by generating the appropriate Eclipse project files.
However, it seems now that the M2Eclipse plugin has been swallowed up by Eclipse and importing Maven projects now seems to read the pom and try to do the Right Thing.
Does this mean the maven-eclipse-plugin is essentially obsolete? What can we do to help our projects import into Eclipse in the best possible way?
I just downloaded and installed Eclipse for Java EE (Indigo), and installed the m2e plugin via the normal installation process with the location download.eclipse.org/technology/m2e/releases, and was able to import maven projects without error.
Compiling Maven Projects in Eclipse The Maven build tool helps us to automate our software build process, and Eclipse comes bundled with Maven as a plugin. However, Maven doesn't come bundled with any Java compilers. Instead, it expects that we have the JDK installed.
M2Eclipse provides tight integration for Apache Maven into the Eclipse IDE with the following features: Launching Maven builds from within Eclipse. Dependency management for Eclipse build path based on Maven's pom. xml. Resolving Maven dependencies from the Eclipse workspace without installing to local Maven repository.
maven eclipse plugin and m2eclipse (now m2e) are independent projects. They stopped working together from 2.7
release of maven eclipse plugin (when maven eclipse plugin dropped eclipse:m2eclipse
goal).
I believe you can use maven eclipse plugin with Eclipse if you do not have m2e plugin, but the support, especially for wtp is limited, if not non-existent.
From a methodology perspective, I would really prefer the m2eclipse way -- i.e. Eclipse invoking maven for builds, so it does exactly the same thing as a pure maven-build.
The problem I found with the m2eclipse, though, was that it always got so horribly, ridiculously, go-have-a-coffee-break-while-you-wait-for-it slow performance, when the maven project became larger adding more and more sub-projects.
I first tried it in 2010, and finally gave up on it. Tried it again a year later, and to my dismay it still sucked just as much -- I dont get it -- it takes MUCH MUCH longer than just building with "mvn clean install" directly -- shouldnt it actually do the same thing???
The "mvn eclipse:eclipse" plugin, on the other hand, works like a charm, as long as you just have a PURE java/jar/war build. But if the maven build does other "plugin" stuff, for example legacy rmi-compiles or using ant for sub-tasks, etc, that will just be ignored during the Eclipse-build and so doesnt work.
The workaround for that is that you FIRST need to build the project ONCE in maven, then run "mvn eclipse:eclipse", then you can edit java-code and it works in Eclipse -- as long as you dont do Project => Clean !
If you do you that (or change anything in the maven-plugins parts Eclipse doesnt understand about) you need to re-build in maven, then do eclipse:eclipse again, then refresh the project in Eclipse. Thats how I usually work, and I think and it works good enough.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With