views:

610

answers:

3

I am running both maven inside the m2eclipse plugin, windows command line and my cygwin command line.

cygwin's bash shell dumps artifacts into the cygwin /home/me/.m2 directory

but m2eclipse & windows shell (on vista) uses /Users/me/Documents/.m2

Is it possible to tell the mvn command to use one central .m2 directory ?

Thanks

+7  A: 

Sure, several ways. The most typical is to specify this in your settings.xml file:

<settings xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd"&gt;
  <localRepository>/my/secret/repository</localRepository>
</settings>
Alex Miller
+1  A: 

For Cygwin, create a file called ~/.mavenrc and put the following text inside:

MAVEN_OPTS="-Dmaven.repo.local=c:\documents and settings\user\.m2"
export MAVEN_OPTS

Alternatively, you can create the file under /etc/.mavenrc

Another option is to create NTFS junction between .m2 under your windows and your cygwin profile.

ddimitrov
Just set it in the settings, there's no need for editing the MAVEN_OPTS for this (which is intended to pass values to the jdk)
Brian Fox
A: 

Just specify it in the settings. No need for cygwin heroics here.

Brian Fox