Maven2 Eclipse integration - eclipse

There seem to be two rival Eclipse plugins for integrating with Maven:
m2Eclipse
and
q4e.
Has anyone recently evaluated or used these plugins?
Why would I choose one or the other?

Side by side comparison table of three maven plugins.

There is only one point where q4e is actually better: dependency viewer. You could see the dependency tree, manage your dependencies visually and even see them in a graph. But, m2eclipse works in a better way, specially because you can create you own build commands (in the run menu). q4e comes with some predefined commands and I can't find where to define a new one. In other words, m2eclipse is more friendly to the maven way.

I have been using m2Eclipse for quiet some time now and have found it to be very reliable. I wasn't aware of q4e until I saw this question so I can't recommend one over the other.

My 2cents,
I am using eclipse for some months now with m2eclipse integration. It's easy to use and straight forward. Once you associate your project to maven and update the dependencies using m2eclipse, any change to pom.xml are reflected to entire project, even Java version definition causes it to be compiled in right JRE (if you have it installed, and properly configured into eclipse.)
Another advantage I found is the maven plug-ins are easy to use integrated with eclipse (jetty being my best example, again, properly configured you can easily integrate maven, jetty-plug-in and Eclipse Debugger)
Compilation, packaging and all other maven features are equally easy to use with a couple clicks or shortcuts.
About q4e I have been reading a lot of good stuff about it and seems the next versions will do a lot more than m2eclipse, with a better dependency management and even visual graphs (!) but the general opinion is that m2eclipse is still better than q4e but q4e is getting better each new version and maybe will surpass m2eclipse soon.

Related

How do I run SBT from within Eclipse?

So far I've been running IntelliJ IDEA Community Edition for my Scala projects, but as my projects are expanding in complexity, I stumble upon more and more roadblocks with the IDE.
Like for example the simple fact that IDEA doesn't allow for web-development or Java EE development what so ever, which means using the Play Framework or TomEE in Community Edition leads to nothing but dead ends and frustration.
The only reason I switched to IDEA in the first place, is because of its excellent plugin system, allowing me to run SBT seamlessly as the primary scala compiler and library downloading tool with ease.
Searching around on Google, however I can only seem to find mentions about the eclipse plugin for sbt, that makes an sbt project Eclipse friendly, which is the exact opposite of what I'm really looking for.
I'm not willing to spend €89 per year for a student licence after all the pain it's put me through so far...
So my question is; is there a plugin for Eclipse that allows me to use SBT the same way as in IDEA? Or am I forced to go through the console?
There may be some movement in this direction in the future, but for now there is no such plugin.
Currently there is no Sbt plugin for Eclipse. Depending on your use-case, you could:
use the Eclipse builder
Pros: proper integration (error markers in Problems and editors, cancelation, progress reporting)
Cons: may get out-of-sync with the Sbt build file (when adding a dependency, for example), doesn't handle anything other than Java and Scala (like Play templates or route files)
use Sbt on the command line (make sure to disable auto-building in Eclipse)
Pros: can handle complex builds, classpath is always up to date
Cons: no integration (see above)
use Activator
Same Pros and Cons as Sbt, but with a pretty UI
We are working on an sbt-server plugin for Eclipse, which will delegate the build to an external Sbt process without giving up the convenience of integration. We hope to have something out towards the end of this year.
I think the main problem you are trying to solve for is too have sbt jar dependencies show up and get used natively by your eclipse project. You can do that with the IvyIDE plugin (which is found in the eclipse marketplace).
If you have that installed (and the eclipse plugin for sbt) then this closes the gap between systems.
To enable:
type the {sbt deliver-local} command from your terminal. This adds an ivy xml in your project's target directory
right click on your project. Choose the Ivy -> enable Ivy dependency management option
go into your projects properties. Highlight the Ivy property. Click the new button and navigate to the ivy xml file in your projects target directory.
Now your eclipse compiles off of your sbt managed dependencies and now you are doing everything you want except actually running sbt from within eclipse (which you only have to do now when you are changing dependencies)

How does the m2e eclipse plugin interact with eclipse?

I am an eclipse power and who has ignored maven due to the historically poor maven / eclipse integration. m2e seems to be maturing and I am taking it out for a serious test drive.
I want to understand how m2e works within eclipse, so I can better get the two working smoothly together and to understand the still cryptic error messages and problems that arise.
I have tried googling for an explanation of the m2e eclipse integration architecture and found nothing that provides a good account of how the integration works. rather just a lot of scattered blog posts all over the web.
Can anyone provide a solid overview of how m2e bridges the gap between the eclipse view of the world and maven view of the world? Especially how does maven integrate into the incremental builds that eclipse does? What is the impact on eclipse stability / performance from using m2e.
I have found the details I was looking for in a Presentation from Eclipse Con titled "m2e, an exercise in mixing oil and water"
http://www.eclipsecon.org/europe2012/sites/eclipsecon.org.europe2012/files/EclipseConEU2012-m2e-talk.pdf
Abstract:
m2e is a popular Eclipse IDE plugin with stated project goal "to
provide a first-class Apache Maven support in the Eclipse IDE". In
this talk I will give an overview of Maven/Eclipse integration
approach implemented by m2e, highlight differences between Maven and
Eclipse that make proper integration difficult or impossible and will
discuss possible ways to improve the integration. The talk is targeted
at Eclipse and Maven developers who want to better understand
challenges of Maven/Eclipse integration and advanced m2e users who
want to know what happens "under the hood".
Sonatype has a pretty good book about it at http://www.sonatype.com/Support/Books/Developing-with-Eclipse-Maven
In short, m2e will setup your Eclipse base on the Maven POMs of your projects, and it provides you access to Maven commands
these are some of the most obvious things m2e done:
setup the source folder and output directory according to POM
Setup dependencies/libraries and project dependency base on POM
Use corresponding Eclipse plugins base on Maven plugins (if M2E knows how to deal with it)
etc.
Allow you to run Maven goals
etc.....
It is neither a formal nor a accurate description, but I wish it give some basic idea :P

Differences in NetBeans and Eclipse for maven projects [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
What are the differences between Netbeans and Eclipse for working with maven projects?
I'm Eclipse user, but to be perfectly honest I have to say that Maven support in Eclipse isn't perfect and often cause weird errors you resolving by cleaning, recompiling, regenerating project files etc.
As far as I know, IDEA and NetBeans have far better support for Maven.
NetBeans has native support for Maven.
What does that mean exactly? It means that if you have a Maven-based project in NetBeans then the pom.xml is what the IDE uses for project definition. The POM is the definition!
Contrast this with Eclipse where Maven support is bolted on top of Eclipse's project definition. This means that any Eclipse solution will have to concentrate on converting to/from Eclipse's own project definition and the POM. I believe this is the root cause of Eclipse's sometimes-less-than-optimal Maven support.
In NetBeans, if your project is Maven-based, then all actions are carried out by Maven. Even the "run" action is effectively done by Maven. The IDE only triggers it. Having this consistency means that you can be sure that your project behaves exactly the same for example if in a non-IDE environment such as a Jenkins/Hudson.
I've met many people who believe that Maven is cumbersome. When you talk some more about it turns out that their bad experience to a large extent comes down to their experience with Maven from within Eclipse, not so much Maven itself. Users of Eclipse tend to think that this is just the way it is supposed to be because they've never seen anything else. (NetBeans users do the same in the opposite direction in the areas where NetBeans is sub-optimal and Eclipse shines)
Let there be no doubt: Eclipse has MANY virtues. Maven support is not one of them.
Starting on an maven based project is much more easier in Netbeans and IDEA than using Eclipse.
in Eclipse, you have to configure your existing project to use maven. Starting by enabling a appropriate maven plugin
using Netbeans and maven is much more easier. Open -> Projekt -> select the pom.xml and you are ready
IDEA has a similar approach. You simply have to import a the project from the existing pom.xml
I have chosen IDEA as my favorite IDE and I'm quite happy with the maven support. Sometimes I have to open NetBeans and at least the maven support works as expected. My own experiences with Eclipse are a little bit outdated but I hear a lot of complaints from my colleagues using Eclipse together with maven.
m2e is the "latest" maven eclipse integration (not to confuse with the old m2eclipse). I really thank all people who spend their time in developing eclipse, maven and m2e - it's my daily work setup, but m2e is far from perfect. Just have a look at the latest "M2E plugin execution not covered" dilemma. If you use non mainstream plugins you have to modify your pom.xml for the m2e usage - just to avoid project errors in eclipse.
To run my mave commands I prefer the command line instead m2e.
As I know Netbeans uses maven more "native" and therefore has not that kind of integration problems. But I am not sure about it. If you have the choice you should compare both possibilities.
I've used both Eclipse and Netbeans. I've used Eclipse more at the university, and professionally it was mixed between Eclipse and Netbeans.
Eclipse is far better than Netbeans depending on the domain.
If you want to work with scala - no other way, eclipse scala plugin is heavily maintained and works much better than Netbeans. If you want to work with perl, same thing.
If you have a massive project with more than 50 large modules and need to do cross cutting refactoring, you are faster with mvn eclipse:eclipse on your root pom, and leting eclipse import and build the project, and then starting with your refactoring.
With that said, when you are doing feature development. And your base project is built in the CI by maven. Oh! Then I can promise you, Netbeans is light years better than eclipse. They are not in the same league when you add maven as the build tool into the equation.
With eclipse, you have to give in and say:
- It is beyond me I let eclipse work as my own built tool and I keep away from the command line. If I even go to a folder and do mvn clean install, eclipse with fight against me.
With netbeans, he just does not try to re-invent the wheel. He lets maven do what maven does, and build your project. It runs your tests with surefire.
In my personal opinion, for Java EE development - namely adding features and "NOT" doing cross cutting massive refactoring and your project is built on maven, Netbeans is by far the best IDE. It is perfect.
It is simplicity in itself. A simple and confortable user interface.
A perfect debugger.
Perfect JSF to bean navication.
Perfect maven integration.
Perfect colaboration with Jrebel.
Netbeans is simple and super effective.
I've found Eclipse to be my enemy, when i want to use maven to run all unit tests or for wahtever reason. If I want to deploy a WAR built by maven ... better not! I need to absolutely give myself into eclipse and let it own everything. I need to keep well away from a command line.

Managing external jar dependencies

I'v written a selenium framework which needs to be extended to the team. I've checked in the code in SVN. How can I make sure that external jars are added to build path and folder that folder by other team members? Basically I want to manage these dependencies better. Somebody said, Maven can take care of these so I tried to install m2eclipse plugin for eclipse 3.2 without any success. Can Maven solve this problem and is there any better way of managing it?
Do the easy way: commit the jars into SVN. It will save everybody a lot of time.
If you are amenable to using Eclipse, Maven, and m2eclipse, I would suggest using SpringSource Tool Suite. It is an Eclipse based IDE with Maven and m2eclipse pre-bundled. This bundling makes getting those three tools to work together very easy.

synchronising / maintaining ant and eclipse classpaths

I'd be interested to find out about any automated processes that people have for ensuring that the project classpaths for the ant and eclipse configurations are in synch. In my case, I want the classpath defined in the ant build file to be the master configuration, since its used for our production builds. As part of the build i'd like to add an ant target that will verify that the eclipse classpath is up to date, or at least indicate differences between the two classpaths.
I'm aware of ant4eclipse but its focus is in the opposite direction, ensuring that the eclipse classpath is master and that the ant build reuses the eclipse path. I like the idea behind AntAndEclipse but am wondering are their ant other tools in this space that i'm not aware of.
You solution at a previous company was to have ant invoke Eclipse to do the compiles as described here:
http://www.eclipse.org/articles/Article-PDE-Automation/automation.html
I'm not aware of any ant tools which can do this but I've switched from ant to Maven a few years ago and never looked back. You can use the "Maven integration for Eclipse" to make Eclipse use the Maven classpath.
As of today, I'm not 100% happy with the Eclipse plugin, though. It's a bit slow and due to the different philosophy of Eclipse and Maven, some operations behave strange. For example, Eclipse doesn't differentiate between a "production" and "test" classpath, so you can get compile errors in Maven when everything looks great in Eclipse.
My solution was to use the plugin to keep the classpath in sync and compile from the commandline.
there is an ant task to do xml transformations, we used that task to create the classpath in our build file. It was a little trick to get the XSL right but once it worked it was great
Did you evaluate Apache IVY? Currently I am building a Continuous Integration environment at our place and we use IVY to handle our dependencies. There is a eclipse plugin that takes the dependency configuration of eclipse and uses it as eclipse classpath.
Currently this solution looks quite promising.
My team wrote an Eclipse plug-in to add a new type of library to the Java Build Path->Add Library option in the project settings. This custom library type allowed both Eclipse and ANT to reference the same canonical list of dependencies.
Nowadays, I'd probably look at IVY for doing the same thing if I was locked into using ANT, rather than writing my own.
You need Ant2Eclipse.