centos下安装配置maven
- 下载maven安装包
wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
- 解压安装包
tar -xvf apache-maven-3.3.9-bin.tar.gz
- 删除多余安装包 重命名
rm -rf apache-maven-3.3.9-bin.tar.gz
mv apache-maven-3.3.9/ maven-3.3
- 配置maven环境
vi /etc/profile
# java export JAVA_HOME=/java/jdk-1.8 export PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar # maven export MAVEN_HOME=/java/maven-3.3 export PATH=$MAVEN_HOME/bin:$PATH
- 使配置文件生效
source /etc/profile
- 查看maven版本
mvn -v
修改setting.xml文件
在当前目录下的 maven-3.3/conf/settings.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups>
</pluginGroups>
<!-- 配置jar包下载路径 linux需要更改为/目录开头的linux目录 -->
<localRepository>E:/java/repo</localRepository>
<proxies>
</proxies>
<servers>
</servers>
<!-- 从阿里云镜像下载jar包 -->
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<!-- 指定jdk1.8 -->
<profiles>
<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>
</profiles>
</settings>