Linux .m2 , Ubuntu 中的 settings.xml

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13358635/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 17:46:52  来源:igfitidea点击:

.m2 , settings.xml in Ubuntu

javalinuxmavenubuntupom.xml

提问by someone

In the windows environment you will have .m2 folder in C:\Users\user_name location and you will copy your settings.xml file to it in order to setup your proxy settings and nexus repository locations and etc.

在 Windows 环境中,您将在 C:\Users\user_name 位置有一个 .m2 文件夹,您将您的 settings.xml 文件复制到它以设置您的代理设置和 nexus 存储库位置等。

So What I have to done on Ubuntu environment to get similar setup after installing maven on it.

因此,在 Ubuntu 环境上安装 maven 后,我必须在 Ubuntu 环境中完成类似的设置。

回答by Kent

.m2 directory on linux box usually would be $HOME/.m2

linux 机器上的 .m2 目录通常是 $HOME/.m2

you could get the $HOME :

你可以得到 $HOME :

echo $HOME

or simply:

或者干脆:

cd <enter>

to go to your home directory.

转到您的主目录。

other information from maven site: http://maven.apache.org/download.html#Installation

来自 maven 站点的其他信息:http: //maven.apache.org/download.html#Installation

回答by Behe

Quoted from http://maven.apache.org/settings.html:

引自http://maven.apache.org/settings.html

There are two locations where a settings.xml file may live:

The Maven install: $M2_HOME/conf/settings.xml

A user's install: ${user.home}/.m2/settings.xml

settings.xml 文件可能存在于两个位置:

Maven 安装:$M2_HOME/conf/settings.xml

用户安装:${user.home}/.m2/settings.xml

So, usually for a specific user you edit

因此,通常对于您编辑的特定用户

/home/*username*/.m2/settings.xml

To set environment for all local users, you might think about changing the first path.

要为所有本地用户设置环境,您可能会考虑更改第一个路径。

回答by jens-na

You can find your maven files here:

您可以在此处找到您的 Maven 文件:

cd ~/.m2

Probably you need to copy settings.xmlin your .m2folder:

可能您需要将 settings.xml 复制到您的.m2文件夹中:

cp /usr/local/bin/apache-maven-2.2.1/conf/settings.xml .m2/

If no .m2 folder exists:

如果不存在 .m2 文件夹:

mkdir -p ~/.m2

回答by Thomas

As per Where is Maven Installed on Ubuntuit will first create your settings.xml on /usr/share/maven2/, then you can copy to your home folder as jens mentioned

根据Maven 安装在 Ubuntu 上的位置,它将首先在 /usr/share/maven2/ 上创建您的 settings.xml,然后您可以像 jens 提到的那样复制到您的主文件夹

$ cp /usr/share/maven3/conf/settings.xml ~/.m2/settings.xml

$ cp /usr/share/maven3/conf/settings.xml ~/.m2/settings.xml