Maven Getting Started Tutorial two----maven dependency

Source: Internet
Author: User

    • Dependency Package Query

Through the coordinate store, gav-groupid,artifacld,version
Some online warehouses are on their own, nexus,http://mvnrepository.com.
Transitive dependency
Range of dependencies:
Dependency transitivity: Dependencies are passed.
A--c,b--a, then b--c (delivery based on the compile range). Pom.xml in the scope if there is no declaration, then the default is compile
If the declaration of scope is test, then this dependency is not passed to another compile package
Test: When a war is made, it will not be hit in the package, nor will it be delivered. Neither compiling nor packaging will use this package.
Compile: The compilation scope is valid, in the compilation, the packing all needs
Provided: Valid during compilation and testing, and will not be added when the war package is last generated. such as: Servlet-api.jar because the Tomcat server already exists, if repackaging will conflict
Runtime: Run-time dependent, compile-time not dependent
Import
System

    • Dependency transitive conflict

1, a--b1.0,b--b1.1 D--a and C, in D, which one depends on the order of first write to use the first write dependent version
If d--><d>a<d> and <d>b<d> then rely on B for 1.0
2, A--b1.0,b--b1.1,d--a and c==>b1.0,f-->d,c, select Shortest Path f--b1.1
3. If you want precise control of the dependency package, you can use the dependent exclusion function
Dependencies,dependency under exclusions, exclude packages that do not need to be relied on, Gav declaration

    • Dependent aggregations

A place to compile multiple files, in Eclipse Maven follows project, and idea follows the module.
In eclipse, you can compile and package all project pom,<packaging>pom<packaging> by writing a Pom.xml (packaged method).
Idea, a project can have more than one module, so there is a default of Pom.xml

    • Pom Inheritance

Parent class can be defined, version, encoding and other information, such as the introduction of the parent tag, will inherit the configuration
The parent class can import all the packages used, declare the dependencies through the dependencymanagement tag, and the subclass can only declare groupid and Artifactid to find the package, and the version inherits from the parent class.

Maven Getting Started Tutorial two----maven dependency

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.