Java Quick Start Experience
1. Environmental information
1.1 Hardware information
- Model : MacBook Pro
- Memory : 16GB
- Hard disk : 512GB SSD
- Processor : Apple M2
- Host CPU architecture : ARM
1.2 Software information
- Maven version : 3.8.8
- J DK version : 17
Two, Maven installation
2.1 Introduction to Maven
Maven is a project management tool whose main function is to manage dependencies and build projects for Java projects during the project development phase .
- Dependency management: It is the management of jar packages. By importing maven coordinates, it is equivalent to importing the jar package in the warehouse into the current project.
- Project construction: The entire process of cleaning, compiling, testing, reporting, packaging, and deploying the project can be completed with one command of maven.
2.2 Maven installation package download
Download address: Apache Maven
2.3 Maven installation
Unzip to /usr/local/maven
# 环境配置
vim ~/.zshrc
# 输入
#>>>Maven>>>
export M2_HOME=/usr/local/maven/apache-maven-3.8.8
export PATH=$PATH:$M2_HOME/bin
#<<<Maven<<<
# 使配置生效
source ~/.zshrc
# 环境测验
echo $M2_HOME
mvn -v
2.4 Maven initialization
Modify the image source to Alibaba Cloud
# 进入到maven目录
cd /usr/local/maven/apache-maven-3.8.8/conf
vim settings.xml
# 修改仓库地址
<localRepository>/usr/local/maven/maven-3.8.8/repo</localRepository>
# 新增如下配置
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>https://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
3. Java installation
3.1 JDK download
Select the corresponding package to download according to the computer model and CPU architecture, download address: JDK download
3.2 JDK installation
After downloading dmg, click directly to complete the installation
# 查看java版本号确认是否安装完成
java -version
3.3 JDK initialization
# 环境配置
vim ~/.zshrc
# 输入
#>>>JDK17>>>
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home
export PATH=$PATH:$JAVA_HOME/bin
#<<<JDK17<<<
# 使配置生效
source ~/.zshrc
4. Construction of development environment
4.1 Install development tools
4.2 Associate Maven environment
4.2.1 Create a new JAVA project
4.2.2 Integration of Maven and IDEA
- Open the Settings page of IDEA
- Enter Mavem in the search box
- Modify Maven Home, settings.xml path and warehouse path
5. Hello Word
So far, the Java quick start experience is completed, and Java-related chapters will be output in succession~ If you encounter any problems during the review process, please leave a message or private message for communication.