File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Change maven local repository in Sonatype plug for eclipse

 
Oscar G. Rodriguez
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody.

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?

Thanks

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?
 
Jan Cumps
Bartender
Posts: 2577
11
C++ Linux Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, Oscar!
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Oscar G. Rodriguez
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Peter,

thanks for your comment and sorry for my English, it isn`t as good as I'd like.

Well, I've tried to explain that with an external maven installation, I can change the .m2 location, but not from eclipse plugin, even using the same settings.xml.

I change the settings.xml, pointed by "Global settings for embedded installation" for my modified one.


Finally, I add my external maven to eclipse maven plugin installations, and then it works.

I imagine that the settings.xml that the embedded maven uses, can't be modified by pointing to another one from "Global settings for embedded installation"

This is the configuration that works for me, but if I mark the embedded one, it uses the ~/.m2 folder.






 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic