I changed my computer to MacBook Pro M1, which is used for Java development. The following are the steps to build my Java development environment. If you want to to understand the details of experience, the experience of can go to see my video: www.bilibili.com/video/BV1vw…
- The JDK installation
- Maven configuration
- The IDEA of installation
- The IDEA of Maven configuration
The JDK configuration
Zulu JDK supports M1 chips. Download Azul Zulu Builds of OpenJDK
After downloading, click Install, follow the steps, and enter Java-version on the console
$ java -version
openjdk version "11.0.11"LTS OpenJDK Runtime Environment Zulu11.48+21-CA (build 11.0.11+9-LTS) OpenJDK 64-bit Server VM Zulu11.48+21-CA (build 11.0.11+ 9-lts, mixed mode)Copy the code
Zulu JDK installed by default in/Library/Java/JavaVirtualMachines directory
MAVEN configuration
Download maven, decompress it, go to /opt (uniX-like software is recommended to be installed in /opt), configure MAVEN_HOME, modify the /etc/zshrc file, and add the configuration to the end of the file
exportMAVEN_HOME = / opt/maven/apache maven -- 3.8.1Change the maven installation path to your own file path
export PATH=$PATH:$MAVEN_HOME/bin
Copy the code
Then run source /etc/zshrc for the configuration to take effect
On the console, enter mvn-version
$MVN - version sh - 3.2# mvn -versionApache Maven 3.8.1 c21c65bdfed0f71a2f2ada8b84da59348c4c5d (05) Maven home: / opt/Maven/Apache Maven - 3.8.1 Java version: 11.0.11, Vendor: Azul Systems, Inc., runtime: /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home Default locale: zh_CN_#Hans, platform encoding: UTF-8
OS name: "mac os x", version: "11.4", arch: "aarch64", family: "mac"
Copy the code
Next, set up Maven’s image download repository and Ali’s image source
Go to the
TAB and change the repository address to your new repository folder
<localRepository>/Users/william/maven_repository</localRepository>
Copy the code
Modify the xx/conf/settings. XML configuration file in the Maven installation directory and find the
TAB to add the following configurations
<mirrors>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
Copy the code
IDEA
Download M1’s IDEA Download IntelliJ IDEA and install it directly after downloading it
After the installation is complete, let’s set the default configuration for the new project, mainly the Maven repository configuration
Click Preferences as shown
Select maven configuration and fill in your own Maven configuration.
It is important to be aware of maven repository path permissions if Jar downloads fail due to permissions
To set access to the Maven repository, run the following command
$ chmod -R 777 /maven_repository # Set your own warehouse absolute path here
Copy the code
This article first published: full station port www.ideaworks.club