Dependencies and Dependencymanagement differences in MAVEN Parent

Source: Internet
Author: User

First, write a maven parent

<project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xsi: schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >< Modelversion>4.0.0</modelversion><groupid>com.lala</groupid><artifactid>my-parent </artifactid><version>0.0.1</version><packaging>pom</packaging><properties ><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding></properties>< Dependencies><dependency><groupid>junit</groupid><artifactid>junit</artifactid ><version>4.11</version><scope>test</scope></dependency><dependency> <groupId>redis.clients</groupId><artifactId>jedis</artifactId><version>2.4.0< /version><scope>provided</scope></dependency></dependencies>< Dependencymanagement><dependencies><dependency><groupid>javax.mail</groupid><artifactid>javax.mail-api</artifactid>< Version>1.5.3</version><scope>provided</scope></dependency></dependencies> </dependencymanagement><build><plugins><plugin><groupid>org.apache.maven.plugins </groupId><artifactId>maven-compiler-plugin</artifactId><version>3.3</version> <configuration><source>1.8</source><target>1.8</target><verbose>true</ Verbose></configuration></plugin></plugins></build></project>


The dependencies inside is: 2.4.0 's Jedis

The dependencymanagement inside is: 1.5.3 's Java.mail


The sub-module is written like this.

<parent><groupid>com.lala</groupid><artifactid>my-parent</artifactid><version >0.0.1</version></parent>



will have the following reaction:

1: The submodule automatically introduces the parent module's dependencies dependency without automatically introducing the dependencymanagement dependency

2:dependencymanagement only declares dependencies, does not implement the introduction, so the subproject needs to explicitly declare the required dependencies, and do not need to specify version, scope, the system will automatically use the parent module version, scope




MAVEN Technical Exchange Buckle Group 379165311, the group will occasionally share some Maven articles and tutorials, you are welcome to join

Dependencies and Dependencymanagement differences in MAVEN Parent

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.