Dependencies element in POM. XML in Maven

Source: Internet
Author: User

The basic element of POM. XML, which is used to manage project dependencies on third-party packages. Maven downloads the dependencies of some packages defined in this element to the local repository and allows the project to use them. Ensure that our project can be correctly built and deployed. Dependencies has a dependency element that specifies a package on which the project depends.

Dependency element description
Groupid, artifactid, version: groupid, artifactid, version of the referenced package
Type: Specifies the dependent project type, whether it is a jar package or another type package. The default value is jar.
Optional: If you only want to compile this project, or you do not need this package at runtime, you can set optional to true. If another project references this project, this package will not be dependent.
Classifier: used to differentiate JDK versions. Some packages use different JDK versions and have different suffixes for selection. We can add this classifier. Example: bouncycastle/bcprov-jdk15/135/bcprov-jdk15-135.jar

Systempath: used to specify the specific location of the package. This parameter is set when scope is set to system.
Scope: The scope of the dependency. SCOPE has the following values:
Compile, default value, applicable to all stages and will be released along with the project.
Provided, similar to compile, expects the container or user to provide this dependency.
Runtime, used only at runtime, such as the JDBC driver, applicable to the running and testing stages. This package is not used during compilation.
Test, which is only used for testing and is used to compile and run the test code. Will not be released along with the project.
System, similar to provided, must explicitly provide jar containing dependencies. MAVEN does not search for it in repository and will search for it in systempath. It will not be released along with the project.

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.