Eclipse – setting up a maven project in Juno Eclipse

dependencieseclipsemaven

I recently upgraded my Eclipse to Juno and am struggling with the way maven dependencies are handled.

I installed the m2e plugin. Still, many of my projects started complaining about libraries missing as if the dependencies specified in the pom were completely ignored. This happened despite right-clicking on the project, selecting Configure –> Convert to Maven project, which seems to be the replacement for what used to be "Maven –> Enable dependencies" before. When I looked at the Maven dependencies under the project directory, there were many fewer dependencies listed than in my pom.

Running a maven compile on the command line outside of Eclipse allowed my project to build and after selecting Maven –> Update project, I was able to see the dependencies added or removed accordingly to what I specified in the pom.xml.

Bottom line: maven dependencies seem to work now but I had to do some combination of operations I didn't think should have been needed:
– Configure -> Convert to Maven project
– Maven -> Update dependencies
– Run maven outside of Eclipse

To get everything to work when with previous versions of Eclipse, all I had to do was Maven -> enable dependencies. What is the equivalent of this in Juno, i.e. what is the correct way of setting up juno Eclipse to handle properly a maven project?

Best Answer

I have been using Juno for a while now and the reliable way to solve Maven dependencies from within Eclipse after importing a project that is maven based is simply:

  1. Configure --> Convert to Maven project

  2. Maven --> Update project

Running Maven outside of Eclipse doesn't seem to help.

I am not sure why these two steps are now required when they were not before with previous version of Eclipse (at least, two steps were not needed before for sure).

Running

mvn -Declipse.workspace=<path-to-eclipse-workspace> eclipse:add-maven-repo  

outside of Eclipse has brought me the problems I described in my comment to the other answer.