What will a senior Java development engineer do when he gets a new computer?

 What can you learn from this article?

jdk, maven, idea, springboot, git, nodejs, vscode and many actual environment configurations. It basically covers most of the environments needed by a java programmer.

java development

1. idea (development IDE)

Don't forget to check open file as idea when installing here. It can open files into projects. Don't forget!!

2. jdk1.8 (download from Tsinghua source)

1. Download address

Index of /AdoptOpenJDK / | open source mirror of Tsinghua University | Tsinghua Open Source Mirror
https://mirrors.tuna.tsinghua.edu.cn/AdoptOpenJDK/

2. Install jdk

Here I recommend downloading the zip non brainless installation version, extracting it to your own folder, and then modifying the environment variables accordingly.

Modify system environment variables. In fact, the whole configuration is to locate jdk Follow jre,And a bunch of kits.

Win + R - > sysdm.cpl - > Advanced - > environment variable

1 JAVA_HOME

(jdk path, the next level should be the entire jdk file, and there should be bin in the directory)

2 CLASSPATH

#Don't forget the punctuation marks, the ones in front; Don't forget!!!
.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar;

3 Path

#If you continue to write, it is not in the form of a list. Remember to add a semicolon separator, just like the one after the second bin
%JAVA_HOME%\bin
%JAVA_HOME%\jre\bin;
 

cmd javac java -v Check everything

How to add multiple jdk

Here's how to add multiple jdk s. Because it's difficult to write java for vscode, and the basic environment needs more than 11, but we generally use the 8 environment in maven. Of course, it can be realized by writing the json configuration file of vscode. Here's how the system changes the global configuration

First, clarify the principle: Path,ClassPath All through%JAVA_HOME%To reference Javahome And then find the corresponding file address on this basis, so we can add a layer to let JAVA_HOME adopt%JAVA_HOMEX%(X Is the version number) jdk,In this way, you can create it in the same way jdk11 Can also succeed, and finally through replacement JAVA_HONE To change the jdk Version, as shown in the figure:

3,MAVEN3.6.1

1. Modify environment variables

MAVEN_HOME(maven File directory, follow java Same)

Path Just add one bin Catalog, follow java agreement

#If it is not in list format, you must add semicolon separator
%MAVEN_HOME%\bin;


mvn -v inspect

2. Modify the settings.xml configuration file under config

1.Modify the default local warehouse address

Find the setting file in the conf directory, open the Notepad, and add the localRepository address below to add the local warehouse address (note that the slash is reversed from the folder)

 <localRepository>D:/javaTools/maven_data</localRepository>

2. Modify the alicloud image to store and download maven

  <mirror>
              <id>alimaven</id>
              <mirrorOf>central</mirrorOf>
              <name>aliyun maven</name>
              <url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
  </mirror>

3. Modify the default java and jdk versions (pay attention to the label and change it before the last profiles)

   <!-- java edition --> 
    <profile>
      <id>jdk-1.8</id>
      <activation>
	    <activeByDefault>true</activeByDefault>
        <jdk>1.8</jdk>
      </activation>

      <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
		<maven.compiler.target>1.8</maven.compiler.target>
		<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
      </properties>
     </profile>

3. Set maven in idea as our own by default

because idea After the latest version, it comes with it maven,However, we'd better use our own to facilitate version management. The operations are as follows:

One thing to note here is that the setting is a new project setting. The normal setting only sets the current project, that is, it must be set maven Choose to use the configuration we have previously configured, and change the configuration file override Select the configuration and locate the modified configuration file. The warehouse address at the bottom should directly correspond to the address set by ourselves after our previous modification.

Open a new project again, success!

4. Tips for springboot project

Modify the in the following illustration Serve URL,Change to Alibaba cloud, which initializes quickly, and Alibaba cloud is generally a stable version.

http://start.aliyun.com


Uncheck this compact middle packages,The folder won't collapse

4. git (version control tool)

Download address: https://git-scm.com/downloads , the next version can be mindless. Next, right click the mouse to display Git GUI Here and Git Bash Here. If these two appear, the installation is successful. Use git bash, which is similar to the linux command line. The next article will introduce the knowledge related to linux.

The key is to configure the key so that the machine has permissions

Open git bash, enter ssh key -t rsa -C "your email", and C should be capitalized (here - rsa means encryption)

ssh-keygen -t rsa -C "626683125@qq.com"

Press enter all the way to confirm, and then find the following directory

In this line.pub File is ssh Public key, open it with notepad and paste it into gitee Up, github Similarly.
 

Sign in gitee,Select in settings SSH Public key, copy it. General public key ssh-rsa The beginning, the end of your name

test

Insert picture description here

5. After changing the machine, git pulls the bug in the back-end project configuration

1. lombok fails with annotations

The first pit is OK. The lombok component in the idea fails. I have lombok in my pom, but it's still useless. I set up a lot according to the online tutorial. What's useless? The final solution. Directly change the lombok component version number in the pom file and update the pom file.

2. The Ren fast database cannot be connected

The second problem is that there is a bug in the database and all kinds of exceptions are reported directly. The idea test database can be accessed, but the project can't run. At first, mysql connector java was changed to 5.1.47 (because our mysql version is 5.7), but the bug remains. Finally, the version of the connection component is updated to solve it

~There are so many back-end installed configurations

Tags: Java

Posted on Wed, 13 Oct 2021 17:10:27 -0400 by saco721