前言
跟前端篇一样,当初记录一下后盾利用端开发环境的搭建,针对的是 java 环境,当初分享给大家。
操作
1、下载和装置 Java
下载地址在这
下载 dmg 装置即可,接着查问装置 java 的地位
/usr/libexec/java_home -V
找到 java 装置地位 之后,当初咱们来编辑.bash_profile 文件
, 增加 java 环境
#java home
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home
export CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.
保留完之后,别忘了source ~/.bash_profile
2、下载和装置 Maven
点击官网下载地址下载
下载之后解压到你想要保留的中央即可。
保留完之后,配置一下环境变量,再次编辑~/.bash_profile
#java home
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home
export CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.
# maven home
M3_HOME=/Users/zhangwei/Library/apache-maven-3.5.0
export PATH=$JAVA_HOME/bin:$M3_HOME/bin:$PATH:
这样就实现了 Java 和 Maven 的装置,查看 Java 和 Maven 的版本
java --version
mvn -v
3、配置 maven setting.xml 文件
先找到 maven 装置门路,我的门路是
~/Library/apache-maven-3.5.0/conf/settings.xml
找到之后编辑 setting.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">
<mirrors>
<mirror>
<id>mirror</id>
<mirrorOf>central,jcenter,!rdc-releases,!rdc-snapshots</mirrorOf>
<name>mirror</name>
<url>https://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
</mirrors>
<servers>
<server>
<id>rdc-releases</id>
<username>xxx</username>
<password>xxx(H</password>
</server>
<server>
<id>rdc-snapshots</id>
<username>xxx</username>
<password>xxx(H</password>
</server>
</servers>
<profiles>
<profile>
<id>rdc</id>
<properties>
<altReleaseDeploymentRepository>
rdc-releases::default::https://packages.aliyun.com/maven/repository/2113702-release-6l40oS/
</altReleaseDeploymentRepository>
<altSnapshotDeploymentRepository>
rdc-snapshots::default::https://packages.aliyun.com/maven/repository/2113702-snapshot-zW0Kdb/
</altSnapshotDeploymentRepository>
</properties>
<repositories>
<repository>
<id>central</id>
<url>https://maven.aliyun.com/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>snapshots</id>
<url>https://maven.aliyun.com/nexus/content/groups/public</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>rdc-releases</id>
<url>https://packages.aliyun.com/maven/repository/2113702-release-6l40oS/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>rdc-snapshots</id>
<url>https://packages.aliyun.com/maven/repository/2113702-snapshot-zW0Kdb/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>https://maven.aliyun.com/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>snapshots</id>
<url>https://maven.aliyun.com/nexus/content/groups/public</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>rdc-releases</id>
<url>https://packages.aliyun.com/maven/repository/2113702-release-6l40oS/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>rdc-snapshots</id>
<url>https://packages.aliyun.com/maven/repository/2113702-snapshot-zW0Kdb/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>rdc</activeProfile>
</activeProfiles>
</settings>
这样就配置好了 Maven。
Idea 配置
当初咱们到 idea 中配置 Java 和 Maven 环境
总结
1、
援用
[]()
[]()
[]()
[]()
[]()