java 和 maven 环境配置
精选
原创
©著作权归作者所有:来自51CTO博客作者waring_id的原创作品,请联系作者获取转载授权,否则将追究法律责任
1.说明
系统版本:CenetOS 7 最小化安装
Java版本:jdk-8u192-linux-x64.tar.gz
maven:apache-maven-3.6.3-bin.tar.gz
操作系统安装过程参考:Linux系统安装标准
2.Java 安装
2.1.下载 Java 安装包
将下载的 Java 安装包解压到对应的文件夹
tar zxvf jdk-8u192-linux-x64.tar.gz mv jdk1.8.0_192/ /usr/local/jdk |
2.2.配置环境
vim /etc/profile export JAVA_HOME=/usr/local/jdk export JRE_HOME={$JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH |
2.3.生效及测试
source /etc/profile [root@datax_111 ~]# java -version java version "1.8.0_192" Java(TM) SE Runtime Environment (build 1.8.0_192-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.192-b12, mixed mode) |
3.maven 配置
3.1.下载安装包
通过访问 apache 的官网下载最新版本的 maven。https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/
tar zxvf apache-maven-3.6.3-bin.tar.gz mv apache-maven-3.6.3 /usr/local/maven |
3.2.配置国内源
vim /usr/local/maven/conf/settings.xml <localRepository>/opt/jarstore</localRepository>
<mirror> <id>alimaven</id> <mirrorOf>central</mirrorOf> <name>aliyun maven</name> <url>https://maven.aliyun.com/repository/central</url> </mirror>
<mirror> <id>aliyun-maven</id> <mirrorOf>*</mirrorOf> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror> |
3.3.配置环境
和 java 的环境配置类似。
[root@datax_111 ~]# mvn -version Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) Maven home: /usr/local/maven Java version: 1.8.0_192, vendor: Oracle Corporation, runtime: /usr/local/jdk/jre Default locale: zh_CN, platform encoding: UTF-8 OS name: "linux", version: "3.10.0-1127.8.2.el7.x86_64", arch: "amd64", family: "unix" [root@datax_111 ~]# |