How to install and use maven in vscode?

How to install and use maven in vscode?

1. Download from the official website

apache-maven-3.6.3-bin.zip

decompress

2. Configure environment variables

Add in Path

%MAVEN_HOME%in

Use cmd to verify that the environment variables are configured successfully

3. Configure the maven file

Enter

D:apache-maven-3.6.3-binapache-maven-3.6.3conf

Open settings.xml with a text editor, ctrl+f to find "" and add the following fields

<localRepository>D:apache-maven-3.6.3-binapache-maven-3.6.3存储依赖</localRepository>

Used to specify the dependent files for storing downloads

Then ctrl+f find "" and add the following fields to set the download mirror source

    <mirror>
     <id>alimaven</id>
     <name>aliyun maven</name>
     <url>https://maven.aliyun.com/repository/central</url>
     <mirrorOf>central</mirrorOf>
     </mirror>

4. Configure VSCODE

File-Preferences-Settings input maven, slide down to find

Modify the following two

    "java.configuration.maven.userSettings": "D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\conf\settings.xml",
    "maven.executable.path": "D:\apache-maven-3.6.3-bin\apache-maven-3.6.3\bin\mvn.cmd",

5. Create a simple maven file

First create a blank folder, open it with vscode, right click on the blank space.

Just choose a version, and then choose the location of the maven file, the empty folder I chose.

Start to enter several properties required by the maven file

Created successfully!

At the beginning, it comes with a helloword program, run F5 to see

success!

Guess you like

Origin blog.csdn.net/shuux666/article/details/124115802