1. Overview:
Dependency management is one of the things Maven excels at and is a feature of Maven.
reference : 1) MAVEN official website documentation
2)
2.maven dependency mechanism 1) dependencies in Maven are transitive (transitive denpendencies)
-
-
-
- Pom.xml can inherit from parent Pom.xml
- Other projects on which the project relies on three-party engineering (dependencies) dependencies can be automatically inherited
- Because Maven manages the project, its dependencies are transitive, so it's easy to have a problem that relies on the possibility of forming a loop (cycle)
2) Dependency scope dependent range is controllable
There is 6 scopes available:
-
-
- Compile (default)
This is the default scope, and used if none is specified "specified". Compile dependencies is available in all classpaths of a project. Furthermore, those dependencies is propagated "propagate" to dependent projects.
- Provided
This was much like compile, but indicates you expect the JDK or a container to provide the dependency at runtime. For example, when building a Web application for the Java Enterprise Edition, you would set the dependency on the Servlet API and related Java EE APIs to scope provided because the Web container provides those classes. This scope was only available on the compilation and Test Classpath, and was not transitive.
- Runtime
This scope indicates the dependency is not a required for compilation and is a for execution. It is in the runtime and test classpaths, but not the compile classpath.
- Test
This scope indicates the dependency are not required for normal use of the application, and are only available for the Test compilation and execution phases. This scope is not transitive.
- System
This scope was similar to provided except so you had to provide the JAR which contains it explicitly "explicitly". The artifact are always available and are not looked up in a repository.
- Import (only available in Maven 2.0.9 or later)
This scope is only supported on a dependency for type pom in the <dependencyManagement> section. It indicates the dependency to being replaced with the effective list of dependencies in the specified "specified" POM ' s <dep Endencymanagement> section. Since They is replaced, dependencies with a scope of import does not actually participate in limiting the Transiti Vity of a dependency.
2) How to add external to your project through MAVEN pom.xml dependencies
Maven---> Learning experience--->maven dependency mechanism (dependency mechanism)