最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

maven - Set project version with versions:set download al lot of .pom files and massively slows down Gitlab pipeline - Stack Ove

programmeradmin5浏览0评论

I'm using this command to set the version of my maven project (reference):

mvn build-helper:parse-version versions:set \
  -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.\${parsedVersion.incrementalVersion}\${parsedVersion.qualifier?}

I think versions:set is triggering the download of pom files to local. E.g.

Downloading from .../../2.7.18/spring-boot-dependencies-2.7.8.pom

I suppose because spring-boot-dependencies is used as dependencyManagement and a lot of other pom files are downloaded from remote repository, even libraries not used (e.g. r2dbc pom).

This command is run as part of a gitlab job, which means every time this job runs all these files are getting downloaded. It takes around 20 minutes to finishe, while the entire pipeline is run in 22 minutes. In other words 20 minutes are dedicated to the setting of the project version (during mvn test these files are not downloaded).

Is there any improvement that can be done here?

EDIT:

the question is more about the time needed by the command to run without the cache (the use of cache is suggested here). It would not be a big deal to download the files every time, but it is if this takes 20 minutes. Why this command needs all these files to function? Is this amount of time normal for a project with around 10 dependencies?

I'm using this command to set the version of my maven project (reference):

mvn build-helper:parse-version versions:set \
  -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.\${parsedVersion.incrementalVersion}\${parsedVersion.qualifier?}

I think versions:set is triggering the download of pom files to local. E.g.

Downloading from .../../2.7.18/spring-boot-dependencies-2.7.8.pom

I suppose because spring-boot-dependencies is used as dependencyManagement and a lot of other pom files are downloaded from remote repository, even libraries not used (e.g. r2dbc pom).

This command is run as part of a gitlab job, which means every time this job runs all these files are getting downloaded. It takes around 20 minutes to finishe, while the entire pipeline is run in 22 minutes. In other words 20 minutes are dedicated to the setting of the project version (during mvn test these files are not downloaded).

Is there any improvement that can be done here?

EDIT:

the question is more about the time needed by the command to run without the cache (the use of cache is suggested here). It would not be a big deal to download the files every time, but it is if this takes 20 minutes. Why this command needs all these files to function? Is this amount of time normal for a project with around 10 dependencies?

Share Improve this question edited Mar 19 at 0:36 SGiux asked Mar 18 at 15:30 SGiuxSGiux 9313 gold badges15 silver badges39 bronze badges 2
  • This question is similar to: How to enable maven artifact caching for GitLab CI runner?. If you believe it’s different, please edit the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem. – Chin Huang Commented Mar 18 at 16:11
  • The execution of Maven is triggering downloads because to function it required the plugins (build-helper-maven-plugin, versions-maven-plugin) and of course need to check the pom files of your project.. – khmarbaise Commented Mar 18 at 20:55
Add a comment  | 

1 Answer 1

Reset to default 0

First thing is you need to make sure that caching works properly. See e.g. here:

https://stackoverflow/a/40024602/927493

Secondly, downloading the poms and dependencies should not exceed one or two minutes at most. You need to have a look at the build logs and figure out what is wrong there.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论