I'm trying to build maven from source (on Ubuntu 12.04) following the tutorial:
http://maven.apache.org/guides/development/guide-building-m2.html
I installed a previous version of maven using
sudo apt-get install maven
I then checked out maven using:
git clone https://git-wip-us.apache.org/repos/asf/maven.git maven
I then built maven using maven according to the apache guide, so I cd into the checkout version of maven and did:
sudo mvn install
this seemed to work fine, no errors or anything, but when I do
mvn -version
My output is:
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.7.0_40, vendor: Oracle Corporation
Java home: /usr/lib/jvm/jdk1.7.0_40/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.5.0-37-generic", arch: "amd64", family: "unix"
Which is not the version I checked out, it's the version of maven I got from apt-get. What exactly did mvn install do? Where did it install maven to, and how do I update the mvn command?
I've been digging through the output of mvn-install . It seems it's creating jar files, for example, some of the outputs are:
[INFO] Installing /opt/maven/maven-core/target/maven-core-3.1-SNAPSHOT.jar to /root/.m2/repository/org/apache/maven/maven-core/3.1-SNAPSHOT/maven-core-3.1-SNAPSHOT.jar
[INFO] Installing /opt/maven/maven-core/pom.xml to /root/.m2/repository/org/apache/maven/maven-core/3.1-SNAPSHOT/maven-core-3.1-SNAPSHOT.pom
if I cd into /root/.m2/repository/org/apache/maven/maven-core and do a ls -la
I see
drwxr-xr-x 9 root root 4096 Sep 25 15:31 .
drwxr-xr-x 33 root root 4096 Sep 25 15:31 ..
drwxr-xr-x 2 root root 4096 Sep 25 15:30 2.0
drwxr-xr-x 2 root root 4096 Sep 25 15:30 2.0.1
drwxr-xr-x 2 root root 4096 Sep 25 15:30 2.0.6
drwxr-xr-x 2 root root 4096 Sep 25 15:30 2.0.9
drwxr-xr-x 2 root root 4096 Sep 25 15:31 2.2.1
drwxr-xr-x 2 root root 4096 Sep 25 15:30 3.0
drwxr-xr-x 2 root root 4096 Sep 25 15:31 3.1-SNAPSHOT
The last entry seems really suspicious. If I change directory into that and list it's contents I see:
-rw-r--r-- 1 root root 557420 Sep 26 08:45 maven-core-3.1-SNAPSHOT.jar
-rw-r--r-- 1 root root 7270 Sep 26 08:44 maven-core-3.1-SNAPSHOT.pom
-rw-r--r-- 1 root root 706 Sep 26 08:45 maven-metadata-local.xml
-rw-r--r-- 1 root root 186 Sep 26 08:45 _maven.repositories
Which is different then what the contents of
/root/.m2/repository/org/apache/maven/maven-core/3.0
are. They are:
-rw-r--r-- 1 root root 6629 Sep 25 15:30 maven-core-3.0.pom
-rw-r--r-- 1 root root 40 Sep 25 15:30 maven-core-3.0.pom.sha1
-rw-r--r-- 1 root root 154 Sep 25 15:30 _maven.repositories