问题
I am already using maven outside of eclipse, but would like to use Eclipse as my main editor. I don't want to use the maven already embedded with M2E. I want to use mine located at /usr/bin/mvn.
Under Window > Preferences, I try to add a maven installation at /usr/bin/mvn (clicking Ok does nothing; stays at the same window) and at /usr/bin (gives the error: The selected directory is not a valid Maven directory.
.
回答1:
Ask your maven where is Maven Home
$ mvn -V
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 14:51:28+0100)
Maven home: /home/myuser/maven
and in Eclipse add Maven Home to Maven Installation settings.
But better solution is to use Maven distribution from http://maven.apache.org/. Simply unpack this and configure in Eclipse. Maven from system distribution work great with application installed from system and is not good for development.
回答2:
/usr/bin/mvn
is where the binary is placed, actual maven installation directory might be at /usr/share/maven
来源:https://stackoverflow.com/questions/16127739/using-maven-outside-of-eclipse