1. Copy the project to the workspace (that is, the folder where the project is located)
2. Find the pom file of the project, double-click to import it
Import jar package using coordinates
<dependencies>
Write tags in pom.xml<dependencies>
Use<dependecy>
import coordinates in labels- groupId, artifactId, version that define the coordinates
- Click the refresh button to make the coordinates take effect
This is the refresh button
If you often forget to click refresh, then the configuration cannot be successful, but you can do
this without clicking refresh, and it will automatically refresh after the modification is completed
If you don’t know how to import the package, you can also Alt+Insert, click Dependency
and enter the name of the jar package you need to automatically generate the label
Dependency scope
- By setting the dependent scope of the coordinates (scope), you can set the scope of the corresponding jar package: compilation environment, test environment, running environment
compile : Acts on the compilation environment, test environment, and runtime environment.
test : Act on the test environment. The typical one is the Junit coordinates. When using Junit in the future, the scope will be specified as this value
provided: it acts on the compilation environment and the test environment. We will learn about servlet-api later. When using it, the scope must be set to this value, otherwise an error
will be reported during
runtime. The jdbc driver generally sets the scope to this value, and of course there is no problem if it is not set.