linux下安装maven
程序员文章站
2022-06-18 16:50:16
...
下载
官网下载,地址如下:
https://maven.apache.org/download.cgi
解压
在自己的环境安装目录下解压:
tar -zxvf apache-maven-3.6.2-bin.tar.gz
配置更改
更改maven配置为可选项
$ cd apache-maven-3.6.2/
$ vim conf/settings.xml
自定义本地仓库位置:
<localRepository>~/program-file/apache-maven-3.6.2/repository</localRepository>
自定义镜像仓库:
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
自定义默认java版本:
<profile>
<id>jdk1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
环境变量配置
ubuntu18.04
sudo vim /etc/profile
添加如下maven的path信息:
# maven
export MAVEN_HOME=/home/lazycece/program-file/apache-maven-3.6.2
export PATH=$PATH:$MAVEN_HOME/bin
生效环境变量:
$ source /etc/profile
$ mvn -version
Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T23:06:16+08:00)
Maven home: /home/lazycece/program-file/apache-maven-3.6.2
Java version: 1.8.0_201, vendor: Oracle Corporation, runtime: /home/lazycece/program-file/jdk1.8.0_201/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-65-generic", arch: "amd64", family: "unix"
推荐阅读
-
PHP之--CentOS下php安装mcrypt扩展(插曲)
-
Ubuntu Linux下编译PostgreSQL 8.3.4学习体会
-
CentOS下Redis 2.6.14安装配置
-
Windows7下安装SQL Server 2008报错
-
Ubuntu 下安装 Nginx ( Nginx + Php5-fpm )
-
Redhat Linux AS4下的LAMP与Discuz安装_PHP教程
-
windows下安装php5.5的redis扩展,php5.5redis_PHP教程
-
PHP在Linux下连接MSSQLServer的配置方法简述(一、Sybase库)_PHP
-
linux - CLI里CURL访问某URL速度正常,PHP环境下却访问很慢?
-
linux下类无法实例化