I am running both maven inside the m2eclipse plugin, windows command line and my cygwin command line.
我在m2eclipse插件,windows命令行和我的cygwin命令行中运行maven。
cygwin's bash shell dumps artifacts into the cygwin /home/me/.m2 directory
cygwin的bash shell将工件转储到cygwin /home/me/.m2目录中
but m2eclipse & windows shell (on vista) uses /Users/me/Documents/.m2
但是m2eclipse和windows shell(在vista上)使用/Users/me/Documents/.m2
Is it possible to tell the mvn command to use one central .m2 directory ?
是否可以告诉mvn命令使用一个中心.m2目录?
Thanks
3 个解决方案
#1
4
For Cygwin, create a file called ~/.mavenrc and put the following text inside:
对于Cygwin,创建一个名为〜/ .mavenrc的文件,并将以下文本放入:
MAVEN_OPTS="-Dmaven.repo.local=c:\documents and settings\user\.m2\repository"
export MAVEN_OPTS
Alternatively, you can create the file under /etc/.mavenrc
或者,您可以在/etc/.mavenrc下创建该文件
Another option is to create NTFS junction between .m2 under your windows and your cygwin profile.
另一种选择是在windows下的.m2和你的cygwin配置文件之间创建NTFS连接。
#2
17
Sure, several ways. The most typical is to specify this in your settings.xml file:
当然,有几种方法。最典型的是在settings.xml文件中指定它:
<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"> <localRepository>/my/secret/repository</localRepository> </settings>
#3
-1
Just specify it in the settings. No need for cygwin heroics here.
只需在设置中指定即可。这里不需要cygwin英雄。
#1
4
For Cygwin, create a file called ~/.mavenrc and put the following text inside:
对于Cygwin,创建一个名为〜/ .mavenrc的文件,并将以下文本放入:
MAVEN_OPTS="-Dmaven.repo.local=c:\documents and settings\user\.m2\repository"
export MAVEN_OPTS
Alternatively, you can create the file under /etc/.mavenrc
或者,您可以在/etc/.mavenrc下创建该文件
Another option is to create NTFS junction between .m2 under your windows and your cygwin profile.
另一种选择是在windows下的.m2和你的cygwin配置文件之间创建NTFS连接。
#2
17
Sure, several ways. The most typical is to specify this in your settings.xml file:
当然,有几种方法。最典型的是在settings.xml文件中指定它:
<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"> <localRepository>/my/secret/repository</localRepository> </settings>
#3
-1
Just specify it in the settings. No need for cygwin heroics here.
只需在设置中指定即可。这里不需要cygwin英雄。