Use VS code to create the first Maven project under Ubuntu system

That is as follows:

insert image description here

Here about the use of the linux command line and the use of Vim, you can refer to my other blog. Portal

3) After editing, refresh the environment configuration through the following command to make it take effectsource /etc/profile

4) Verify that the JDK is installed successfully by entering the following commandjava -version

3 Install Maven and configure the Maven environment

============================================================================================

3.1 Download the Linux version of Maven from the official website


[ Official Portal ], where .zipthe suffix is ​​for the Windows system, and .tar.gzthe suffix is ​​for the Linux system.

Download the Linux version of Maven from the official website, and put .tar.gzthe package in the directory you set, here I put it /opt/java/mavenin the newly created directory. As shown in the picture:

insert image description here

3.2 Unzip the compressed package of Maven


Through the terminal, use the command line in this directory: tar zxvf apache-maven-3.6.3-bin.tar.gzdecompress the compressed package. (The compressed package name is the compressed package name of Maven downloaded by myself)

After decompressing the compressed package, you will get a folder with the same name as the compressed package. For the convenience of memory, I changed the folder name to maven3.6 in the above picture.

3.3 Configure the path of the local warehouse


1) Create a local warehouse, as shown above. sudo mkdir localRepository;

2) Open the configuration file as the root user vim settings.xml, and <localRepository> </localRepository>add the address of the local warehouse in the label, for example, mine is: <localRepository> /opt/java/maven/localRepository</localRepository>;

3) At the same time, add the Ali image in the configuration file <mirrors> </mirrors>.

alimaven

"Analysis of Java interview questions in first-line manufacturers + back-end development study notes + latest architecture explanation video + actual project source code handouts"

[docs.qq.com/doc/DSmxTbFJ1cmN1R2dB] Full content open source sharing

aliyun maven

http://maven.aliyun.com/nexus/content/groups/public/

central

3.4 Configure Java environment variables


1) Enter commands in the terminal as the root user vim /etc/profile. If there is a problem that vim does not exist, you only need to apt install vimdownload it through the command line.

2) Add the following information at the end of the file:

export JAVA_HOME=/opt/java/jdk/jdk11

export CLASSPATH= : C L A S S P A T H : :CLASSPATH: :CLASSPATH:JAVA_HOME/lib/

export PATH= P A T H : PATH: PATH:JAVA_HOME/bin

That is as follows:

insert image description here

Here about the use of the linux command line and the use of Vim, you can refer to my other blog. Portal

3) After editing, refresh the environment configuration through the following command to make it take effectsource /etc/profile

4) Verify that the JDK is installed successfully by entering the following commandjava -version

3.5 Configure Maven environment variables


1) Enter commands in the terminal as the root user vim /etc/profile. If there is a problem that vim does not exist, you only need to apt install vimdownload it through the command line.

2) Add the following information at the end of the file:

export MAVEN_HOME=/opt/java/maven/maven3.6

export PATH= P A T H : PATH: PATH:MAVEN_HOME/bin

3) After editing, refresh the environment configuration through the following command to make it take effectsource /etc/profile

4) Verify that Maven is installed successfully by entering the following commandmvn -v

4 VS code configures JDK and Maven

===========================================================================================

4.1 VS code configuration JDK


Open the menu File > Preferences > Settingsand find Java Configurationthe java.home configuration item. In fact, java.homeit is not easy to find the configuration item. Here, it is recommended Settingsto search directly in the search box java.hometo configure the JDK path.

The specific steps are shown in the figure below:

insert image description here

insert image description hereinsert image description here

4.2 VS code configuration Maven


Open it in the menu File > Preferences > Settings, Settingssearch directly in the search box maven, and fill in the two addresses in the picture below to the location of the previously installed Maven.

insert image description here

5 The first Maven project created with VS code under Ubuntu


1) Create a new folder on the desktop.cd Desktop/ mkdir tempFolder

Guess you like

Origin blog.csdn.net/m0_65484000/article/details/122175222