Working experience-a simple Maven accelerated building practice

Source: Internet
Author: User

Note: All compilation, packaging, and deployment are completed through Jenkins.

There is a project in the company. At the beginning, many customer services are expected to be provided. Therefore, the development involves the following structure:

 

FFT-API # public API, all programs must use FFT-client-Hubei # Hubei client FFT-job # timing task FFT-persistent # database connection layer FFT-persistent-API # database connection layer apifft-server # public server. All clients connect to the server, and the server connects to the database connection layer. Pom. xml # parent pom file, which defines general configurations

 

At the beginning. Because the project is simple, it is directly compiled and packaged. Then, get the desired product from a bunch of products for deployment.

 

$ Clean deploy-B-e-u-dmaven. test. skip = true # The output log of the reactor is as follows: [info] scanning for projects... [info] ---------------------------------------------------------------------- [info] reactor build order: [info] [info] froad FFT # Pay Attention to the parent POM in the log. XML changes [info] fft api [info] FFT-persistent-API [info] FFT server [info] FFT client Hubei [info] FFT-persistent [info] FFT job [info] [info] ------------------------------------------------------------------------

 

 

The project structure is as follows:

 

FFT-API # public API, all programs must use FFT-client-Hubei # Hubei client FFT-client-Chongqing # Chongqing client FFT-client-Dezhou # Dezhou client FFT-client-Jiangxi # Jiangxi client FFT- client-Jining # Jining client FFT-client-Lingxian # Lingxian client FFT-client-Neimenggu # Inner Mongolia client FFT-client-Shandong # Shandong client FFT-client-Shiyan # Hubei Shiyan client FFT -Job # timing task FFT-persistent # database connection layer FFT-persistent-API # database connection layer apifft-server # public server. All clients connect to the server, and the server connects to the database connection layer. Pom. XML # define common configuration in the parent pom file # The output log of the reactor is as follows: [info] scanning for projects... [info] ------------------------------------------------------------------------ [info] reactor build order: [info] [info] FFT parent [info] fft api [info] FFT-persistent-API [info] FFT server [info] FFT client Chongqing [info] FFT client Jiangxi [info] FFT client Jining [info] FFT client Hubei [info] FFT client Neimenggu [info] FFT client Shandong [info] FFT client Dezhou [info] FFT client Lingxian [info] FFT-persistent [info] FFT client Shiyan [info] FFT job [info] [info] ------------------------------------------------------------------------

 

Later, we found that the original Command could not meet our needs. The reason is as follows:

  1. It takes a lot of time to compile, package, upload private server libraries, and deploy them to Tomcat.
  2. Any error will automatically stop and need to be corrected by the development.

This reminds me of the cropping reactor we saw when learning Maven. After a while, run the following command:

 

$ Clean deploy-B-e-u-dmaven. Test. Skip = true-pl FFT-API, FFT-client-Shiyan # other clients are the same, which is represented by the Shiyan client. # The output log of the reactor is as follows: [info] scanning for projects... [info] ---------------------------------------------------------------------- [info] reactor build order: [info] # froad parent Pom is not in the reactor. XML [info] fft api [info] FFT client Shiyan [info] [info] ------------------------------------------------------------------------

 

 

With this command, the speed is greatly improved. It would have taken more than 5 minutes to build, but now it has been shortened to 1 minute.

However, after the overall version is upgraded to 2.0.0 one day, the management platform program that relies on the FFT-API will never be built. After querying the error message, it is found that the private server library does not have the parent Pom. xml of 2.0.0.

After carefully querying the Jenkins log, we found that the parent Pom. xml file was not uploaded. Because only the FFT-API and FFT-client-Shiyan sub-modules are available for cropping, parent-level Pom. XML will not be uploaded.

Finally, run the following command:

 

$ Clean deploy-B-e-u-dmaven. test. skip = true-pl-am #-am will automatically build other modules on which the FFT-client-Shiyan module depends # The output logs of the reactors are as follows: [info] scanning for projects... [info] Generator [info] reactor build order: [info] [info] FFT parent [info] fft api [info] FFT client Shiyan [info] [info] Generator

 

Finally, the problem is solved perfectly.

 

Refer:

Http://www.cnblogs.com/zz0412/p/3767146.html

Http://books.sonatype.com/mvnref-book/reference/_using_advanced_reactor_options.html

Working experience-a simple Maven accelerated building practice

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.