.m2 , settings.xml in Ubuntu

169,792

Solution 1

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

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

Solution 2

You can find your maven files here:

cd ~/.m2

Probably you need to copy settings.xml in your .m2 folder:

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

If no .m2 folder exists:

mkdir -p ~/.m2

Solution 3

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

you could get the $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

Solution 4

Quoted from 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

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.

Share:
169,792
someone
Author by

someone

Updated on August 07, 2020

Comments

  • someone
    someone almost 4 years

    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.

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

  • someone
    someone over 11 years
    I couldn't find .m2 in home directory
  • someone
    someone over 11 years
    good suggestion will have a try :)
  • The Cat
    The Cat over 11 years
    If you run something like mvn clean on the command line it normally creates this folder for you. At least it does on windows anyway.
  • Raj Rajeshwar Singh Rathore
    Raj Rajeshwar Singh Rathore almost 3 years
    Was trying it out in a new system so it was not present after doing a fresh mvn clean it got created. Thanks.