Maven Learning note Four (aggregation and inheritance)

Source: Internet
Author: User
Polymerization

Now, if I had created 3 maven projects,

  1. User-core.2.user-log,3.user-service

At this time, if we are going to pack these items, it will be troublesome to get one by one. So do we have a better way to pack the others by just packing one? ma

At this point, we can take advantage of Maven's aggregation features. Create a new, empty Maven project. For example:

Once created, open Pom.xml to write the following configuration:

This time, we only need to execute this empty MAVEN project to complete the package of all the projects.

Inherited

Now, if I had created 3 maven projects,

  1. User-core.2.user-log,3.user-service

We will find that they each have their own pom.xml, each with a lot of repetitive configuration, such as: encoding configuration, each need to configure the version and so on. So we have no better way to write only one, so that others can reuse this part of the method.

MAVEN provides an inheritance feature that can be implemented.

After creation, we will user-core,user-log,user-service inside such as: encoding configuration, common jar configuration information can be put into user-parent inside.

Such as:

Then join in User-core,user-log,user-service's pom.xml:

Maven Learning note Four (aggregation and inheritance)

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.