I'm trying to change the default location of local repository (~/.m2) to a partition.
First, I added <localRepository>I:\.m2\repository</localRepository> in this file.
I change the settings.xml, pointed by "Global settings for embedded installation" for my modified one.
After this, I pointed in Eclipse > Preferences > Maven > User Settings > Local repository (From merged user and global settings) to my new repository path, and even created a user settings.xml at my new location.
I could achieve this with a external maven (3.0.3v), and I'm using the same settings.xml for the maven embedded (3.0.2v), but it didn't work in eclipse. When I do a maven install goal, my project goes to the default repository ~/.m2
Anybody knows what is wrong?
Edit: Well, finally I did it, but I have to add my external maven to Maven > Installations. Isn't there any way to do it without a external Maven?
Not sure exactly what went wrong here. But the final solution of adding your installed copy of Maven to Eclipse and making it the default is really the best way to go. The version embedded in Eclipse is 3.0.2, while 3.0.3 is the latest. By using your installed 3.0.3 version, both Eclipse and the command line will be using the exact same Maven for building.
You should have been able to edit just the ~/.m2/settings.xml file to point to a local repository location, that should work for both the embedded and the external Maven.
I could achieve this with a external maven (3.0.3v), and I'm using the same settings.xml for the maven embedded (3.0.2v), but it didn't work in eclipse.
I am not sure what you mean by this. The embedded Maven settings.xml file is not the same one used by the external Maven, mainly because the M2_HOME location is different for both. The only common settings.xml file between multiple copies of Maven installed on a machine is the ~/.m2/settings.xml file.