Jenkins multi-module compilation skills

Source: Internet
Author: User

Consider the following scenarios:

A git repository contains six Java Projects A, B, C, D, E, F.

A is the underlying module. B Depends On A, C, D, E, F, and A and B at the same time. At this time, the project can be divided into three layers.

Requirements:

1. Jenkins only compiles projects with file changes

By default, as long as one git repository hasCodeThe six projects will all be compiled, which is a waste of resources.

After installing pathignore plugin, set it in each Jenkins project:

** Indicates all sub-directories in the SDK/common directory.

2. Manually specify the compilation Sequence

Because we use Maven projects, Jenkins can know the dependencies between projects based on POM. XML, so it can be automatically compiled layer by layer without setting.

However, Jenkins compiles different projects in parallel. To save server resources, you can set them manually.

You can select the project to be compiled next in build other projects.

3. You can also specify two options in advanced project options:

Block build when upstream project is building

Block build when downstream project is building

Note that 2 and 3 only control the compilation sequence, but 1 still plays a role. If the code of A is submitted and automatically compiled, and B needs to be compiled after Step 1 is specified, rule 1 checks whether B has any code changes. If code B is not modified, the compilation ends. This is very reasonable and saves a lot of resources.

Note: It is only applicable to virtual machine-based languages such as Java. If it is C ++, it is best to re-compile all projects unless you are using a technology similar to com to build the product architecture, and the interface does not change.

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.