安装maven之前先安装jdk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
root@kickseed:~
# mkdir -p work/{soft_dir,app_dir}
root@kickseed:~
# mkdir ~/work/app_dir/jdk
root@kickseed:~
# cd ~/work/soft_dir
root@kickseed:~
/work/soft_dir
# ls
apache-maven-3.5.0-bin.
tar
.gz
koot@kickseed:~
/work/soft_dir
# wget http://repo.souche-inc.com/repository/souche-sre/software/jdk-8u77-linux-x64.tar.gz
root@kickseed:~
/work/soft_dir
# tar xf jdk-8u77-linux-x64.tar.gz -C /root/work/app_dir/jdk
root@kickseed:~
/work/soft_dir
# cd /root/work/app_dir/
root@kickseed:~
/work/app_dir
# ls jdk/
jdk1.8.0_77
root@kickseed:~
/work/app_dir
# ln -sv /root/work/app_dir/jdk/jdk1.8.0_77/ /root/work/app_dir/jdk/current
‘
/root/work/app_dir/jdk/current
’ -> ‘
/root/work/app_dir/jdk/jdk1
.8.0_77/’
root@kickseed:~
/work/app_dir
# ll jdk/
total 12
drwxr-xr-x 3 root root 4096 Sep 5 17:05 ./
drwxr-xr-x 4 root root 4096 Sep 5 17:04 ../
lrwxrwxrwx 1 root root 35 Sep 5 17:05 current ->
/root/work/app_dir/jdk/jdk1
.8.0_77
//
drwxr-xr-x 8 uucp 143 4096 Mar 21 2016 jdk1.8.0_77/
root@kickseed:~
/work/app_dir
# cd jdk/current
root@kickseed:~
/work/app_dir/jdk/current
# ls
bin db javafx-src.zip lib
man
release THIRDPARTYLICENSEREADME-JAVAFX.txt
COPYRIGHT include jre LICENSE README.html src.zip THIRDPARTYLICENSEREADME.txt
root@kickseed:~
/work/app_dir/jdk/current
# pwd
/root/work/app_dir/jdk/current
root@kickseed:~
/work/app_dir/jdk/current
# vim /etc/profile.d/java.sh
root@kickseed:~
/work/app_dir/jdk/current
# cat /etc/profile.d/java.sh
export
JAVA_HOME=
/root/work/app_dir/jdk/current
export
PATH=$JAVA_HOME
/bin
:$PATH
root@kickseed:~
/work/app_dir/jdk/current
# . /etc/profile.d/java.sh
root@kickseed:~
/work/app_dir/jdk/current
# java -version
java version
"1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)
|
maven安装:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
root@kickseed:~
# mkdir -p work/{soft_dir,app_dir}
root@kickseed:~
# cd work
root@kickseed:~
/work
# ls
app_dir soft_dir
root@kickseed:~
# cd work/soft_dir
root@kickseed:~
/work/soft_dir
# wget http://mirror.bit.edu.cn/apache/maven/maven-3/3.5.0/binaries/apache-maven-3.5.0-bin.tar.gz
root@kickseed:~
/work/soft_dir
# ls
apache-maven-3.5.0-bin.
tar
.gz
root@kickseed:~
/work/soft_dir
# tar xf apache-maven-3.5.0-bin.tar.gz -C ~/work/app_dir/
root@kickseed:~
/work/soft_dir
# cd ~/work/app_dir/
root@kickseed:~
/work/app_dir
# mkdir maven
root@kickseed:~
/work/app_dir
# ls
apache-maven-3.5.0 maven
root@kickseed:~
/work/app_dir
# mv apache-maven-3.5.0/ maven/
root@kickseed:~
/work/app_dir
# cd maven/
root@kickseed:~
/work/app_dir/maven
# ls
apache-maven-3.5.0
root@kickseed:~
/work/app_dir/maven
# ln -sv /root/work/app_dir/maven/apache-maven-3.5.0/ /root/work/app_dir/maven/current
‘
/root/work/app_dir/maven/current
’ -> ‘
/root/work/app_dir/maven/apache-maven-3
.5.0/’
root@kickseed:~
/work/app_dir/maven
# ll
total 12
drwxr-xr-x 3 root root 4096 Sep 5 14:42 ./
drwxr-xr-x 3 root root 4096 Sep 5 14:40 ../
drwxr-xr-x 6 root root 4096 Sep 5 14:39 apache-maven-3.5.0/
lrwxrwxrwx 1 root root 44 Sep 5 14:42 current ->
/root/work/app_dir/maven/apache-maven-3
.5.0
//
root@kickseed:~
/work/app_dir/maven
# ls current
bin boot conf lib LICENSE NOTICE README.txt
root@kickseed:~
/work/app_dir/maven
# cd current
root@kickseed:~
/work/app_dir/maven/current
# pwd
/root/work/app_dir/maven/current
root@kickseed:~
/work/app_dir/maven/current
# vim /etc/profile.d/maven.sh
root@kickseed:~
/work/app_dir/maven/current
# cat /etc/profile.d/maven.sh
export
MAVEN_HOME=
/root/work/app_dir/maven/current
export
PATH=$MAVEN_HOME
/bin
:$PATH
root@kickseed:~
/work/app_dir/maven/current
# . /etc/profile.d/maven.sh
root@kickseed:~
/work/app_dir/maven/current
#
root@kickseed:~
/work/app_dir/maven/current
# mvn -v
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-04T03:39:06+08:00)
Maven home:
/root/work/app_dir/maven/current
Java version: 1.8.0_77, vendor: Oracle Corporation
Java home:
/root/work/app_dir/jdk/jdk1
.8.0_77
/jre
Default locale: en_US, platform encoding: UTF-8
OS name:
"linux"
, version:
"4.4.0-31-generic"
, arch:
"amd64"
, family:
"unix"
|
更改maven本地仓库位置
1
2
3
4
5
6
7
8
9
10
11
|
root@kickseed:~
# mkdir /root/work/app_dir/maven/repository
root@kickseed:~
# ls /root/work/app_dir/maven/
apache-maven-3.5.0 current repository
root@kickseed:~
# cd /root/work/app_dir/maven/repository/
root@kickseed:~
/work/app_dir/maven/repository
# pwd
/root/work/app_dir/maven/repository
root@kickseed:~
/work/app_dir/maven/repository
# cd -
/root
root@kickseed:~
# vim /root/work/app_dir/maven/current/conf/settings.xml
使用vim打开后,搜索localRepository 然后在其后添加下面一行
<localRepository>
/root/work/app_dir/maven/repository
<
/localRepository
>
|
本文转自 f_066 51CTO博客,原文链接:http://blog.51cto.com/ganmu/1962927,如需转载请自行联系原作者