首页 Slow Java builds—custom Maven configuration

Slow Java builds—custom Maven configuration

更新时间: 2026-05-29 07:04:53

Problem

Each task node in a Flow pipeline runs in a fresh build environment that is discarded after the job. This causes slow builds because dependencies are downloaded on every run. To improve build efficiency, Flow provides a custom cache feature. You can define a cache directory to share files between pipeline runs, which significantly reduces the time spent re-downloading files.

This problem occurs when you use a custom settings.xml file from your organization that specifies a local repository. If this directory is not configured as a cache directory in the Flow pipeline, the pipeline re-downloads all build dependencies on every run.

Solutions

You can use one of the following two solutions:

  • Remove the <localRepository></localRepository> node from your organization's custom settings.xml file to use the default cache directory. Ensure the Maven cache directory /root/.m2 is added under pipeline orchestration -> variables and cache.

    Important

    Ensure the path to the cache directory is correct and that caching is enabled.

  • Add the directory specified in the <localRepository></localRepository> node of your organization's custom settings.xml file to the cache directory settings under pipeline orchestration -> variables and cache. Ensure the path is correct and caching is enabled.

阿里云首页 云效 相关技术圈