Use maven to add dependencies

1. What is maven

2. Use maven to import dependencies

​​​​

maven:

1. What is maven:

Maven is a tool that facilitates you to build projects. (It’s a tool)

For example, if we need to create a project such as servlet or spring, if we use maven as a tool, we don't need to import many jar packages. We can directly import dependencies in maven's pom.xml file.

2. How to import dependencies

2.1 You can search online and copy other people’s dependencies.

2.2 You can also go to the maven repository and copy and paste the dependencies yourself.

(1) Step one: Enter the maven central warehouse

Search maven central warehouse address

Generally, if you search for the warehouse address, there will be a link to the warehouse. 

(2) Step 2: Search for dependencies

After entering the maven repository, you can search for the dependencies you want to add.

After searching, you can select the dependency you want to add in the search results below.

(3) Step 3: Select the version number

Generally choose the version number with more people.

(4) Copy and paste, and add dependencies

After clicking on the dependency, slide down a little to see the dependency. Click inside the box to copy it. Copy and paste it into the pom.xml file.

 Add dependencies into the pom.xml file:

Note: Dependencies should be added in the large <dependencies> tag.

 

 (5) Select automatic import

After adding dependencies, the version number may become popular. At this time, a small pop-up window will usually pop up in the lower right corner. (Forgot to take a screenshot)

You will be prompted to add maven dependencies. At this time, you can click Auto Import on the right and the dependencies will be imported by yourself.

 

 

Guess you like

Origin blog.csdn.net/m0_58115520/article/details/130311100