• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Change maven local repository in Sonatype plug for eclipse

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Bartender
Posts: 2662
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch, Oscar!
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.






 
Would anybody like some fudge? I made it an hour ago. And it goes well with a tiny ad ...
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic