Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse won't believe I have Maven 2.2.1

I have a project (built from an AppFuse template) that requires Maven 2.2.1. So I upgraded to this (from 2.1.0) and set my path and my M2_HOME and MAVEN_HOME env variables.

Then I ran mvn eclipse:eclipseand imported the project into Eclipse (Galileo).

However, in the problems list for the project (and at the top of the pom.xml GUI editor) it says:

Unable to build project '/export/people/clegg/data/Workspace/funcserve/pom.xml; it requires Maven version 2.2.1

This persists whether I set Eclipse to use its Embedded Maven implementation, or the external 2.2.1 installation, in the Preferences -> Maven -> Installations dialog.

I've tried closing and reopening the project, reindexing the repository, cleaning the project, restarting the IDE, logging out and back in again, everything I can think of! But Eclipse still won't believe I have Maven 2.2.1.

I just did a plugin update so I have the latest version of Maven Integration for Eclipse -- 0.9.8.200905041414.

Does anyone know how to convince Eclipse I really do have the right version of Maven? It's like it's recorded the previous version somewhere else and won't pay any attention to my changes :-(

like image 507
Andrew Clegg Avatar asked Nov 26 '09 19:11

Andrew Clegg


2 Answers

Eclipse allows you to specify an external Maven installation. But there's a catch. :( Have a look at Windows > Preferences > Maven > Installations.

You will see a message like this:

Note: Embedded runtime is always used for dependency resolution, but does
not use global settings when it is used to launch Maven.
To learn more, visit the maven web page.

Translating to English, it means that Eclipse will continue to employ its internal Maven instance in order to perform some tasks. When you "Run As > maven install" it will run your pom.xml script employing the external Maven instance you specified but when Eclipse performs some of its internal stuff, it will continue to use the embedded Maven instance, whatever version it is.

(edited) As far as I know, when you install M2Eclipse you are implicitly defining which "internal Maven instance" you will have, which is exactly that one packaged by the plugin. In the plugin configuration, you can add external Maven instances by telling where they are installed.

like image 100
Richard Gomes Avatar answered Oct 13 '22 01:10

Richard Gomes


If you are using a recent m2eclipse version, you can try this too:

<prerequisites>
    <maven>>=2.2.1</maven>
</prerequisites>

Notice the greater than in >=2.2.1. It works fine for me.

like image 35
Richard Gomes Avatar answered Oct 13 '22 01:10

Richard Gomes