First look at the configuration maven relies on
<dependencies> <dependency> <groupId>....</groupId> <artifactId> ......</artifactid> <version>........</version> <type>......</type> <scope>....</scope> <optional>...</optional> <exclusions> ..... </exclusions> </dependency> ....... </dependencies>
Of
groupId,artifactid , and version: the basic coordinates of dependency (coordinates are not descriptive, and all know)
Type: The default value is the jar (known to be available). Very little to ignore)
Scope: The range of dependencies (this is important. The following continue to speak)
Optional: Whether tag dependency is optional
exclusions: exclusion of transitive dependencies
Range of dependencies:
To be blunt is to control dependence and compile classpath, test classpath, execute classpath relationship.
Dependent range Parameters:
Compile: Compilation dependency range, for compiling, testing, execution of three kinds of classpath are effective. The dependency scope is used by default.
test: test-dependent range, only valid for test classpath. Only need to compile test code and perform test, eg:junit
provided: The dependency range has been provided and is only valid for compilation and test Classpath. Only needed when compiling and testing the project. Eg:servlet-api
runtime: The execution time dependent range. Only valid for test and execution classpath. It's only necessary to perform tests or execute projects, EG:JDBC
System: The range of systems dependencies. (So far I have not been practical, ignoring the good)
It is cool to have a picture to see:
Maven Dependency Range