Uploaded image for project: 'Cloud Enablement'
  1. Cloud Enablement
  2. CLOUD-1389

Investigate whether we need to change the order of maven repositories in settings.xml for more efficient builds

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Do
    • Icon: Minor Minor
    • None
    • None
    • EAP6, EAP7, Java S2I
    • None
    • CLOUD Maintenance Sprint 2

      I've found a trivial way to dramatically reduce the baseline Java build time on our xPaaS images, before doing any further optimization (caching, local Nexus server, incremental builds, ...).

      I've seen that the Maven settings.xml in our base images contains a "hidden" inefficiency in the repository definition, which affects build times dramatically. Correcting it would allow a much better developer experience with negligible effort.

      For example, for our EAP image, in the settings.xml file the Maven profile activated by the S2I assemble script contains these repository entries, in this order:

      https://maven.repository.redhat.com/ga/
      https://maven.repository.redhat.com/earlyaccess/all/
      https://maven.repository.redhat.com/techpreview/all/

      Unfortunately, the majority of the plugins/packages to download during any Java build are not in RH repositories, so at each step Maven tries all our 3 servers before reverting to the default central Maven repository (https://repo1.maven.org/maven2) where they are finally found.
      This makes the whole build process extremely inefficient.

      Changing the profile definition in the settings.xml, to include in first position the central repository, speeds the build time by a factor ranging from 4 to 10 or more (even 15 on my laptop).

      Try comparing the build times for the tasks example application:

      https://github.com/OpenShiftDemos/openshift-tasks
      https://github.com/giuseppetanzi/openshift-tasks

      A similar approach can be used for our FIS applications. In this case the repository used most frequently during the build is

      https://repo.maven.apache.org/maven2

      so defining it as first repository in settings.xml would help.

      As a benchmark, try building this fis-example application and compare times:

      https://github.com/valdar/fis-example
      https://github.com/giuseppetanzi/fis-example

      Of course, instead of overriding the settings.xml file for each project as I've done, maybe it would make sense to change the settings.xml file in our base xPaaS images.

      I'd be glad to hear your opinions on my suggestion.

      Thanks,


      Giuseppe Tanzi

              jsantana@redhat.com Jonh Wendell
              rhn-support-trogers Travis Rogers (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: