Java Quick Start Experience

1. Environmental information

1.1 Hardware information

  1. Model : MacBook Pro
  2. Memory : 16GB
  3. Hard disk : 512GB SSD
  4. Processor : Apple M2
  5. Host CPU architecture : ARM

1.2 Software information

  1. Maven version : 3.8.8
  2. 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.
    insert image description here

2.2 Maven installation package download

Download address: Apache Maven

insert image description here

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

insert image description here

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>

insert image description here

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

insert image description here

3.2 JDK installation

After downloading dmg, click directly to complete the installation

# 查看java版本号确认是否安装完成
java -version

insert image description here

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

insert image description here

4. Construction of development environment

4.1 Install development tools

insert image description here

4.2 Associate Maven environment

4.2.1 Create a new JAVA project

insert image description here

4.2.2 Integration of Maven and IDEA

  1. Open the Settings page of IDEA
  2. Enter Mavem in the search box
  3. Modify Maven Home, settings.xml path and warehouse path

insert image description here

5. Hello Word

insert image description here

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.

Guess you like

Origin blog.csdn.net/ith321/article/details/132459534