Jenkins disables or clears the maven build cache

Our maven projects are based on Jenkins and then deploy artifacts to the maven repository.

For some reason, however, some kind of cache or update timeout is created when a project is created that has dependencies on other projects that have just been created.

Say that the error in artifacts A and B depends on A. Now I fix the error locally, update my dependencies in B, run B and everything is fine. I check, obviously. Now I build A on Jenkins, and then B. Then I get the newly built B and run it. There is still an error. In a few hours, if I build B again, he will kindly receive a new A, and the error will disappear.

So there should be a way to get jenkins to use new A on their server. using mvn -u or mvn --update-snapshots will not help. He will check for updates and not find them.

+7
source share
1 answer

I believe that Maven / Jenkins does not have this caching behavior, since your whole snapshot is created locally in the same Jenkins instance. There is no need for the “update snapshot” option because you are not getting it from the remote repo. However, I would recommend you take a look at the storage settings in Jenkins. In Jenkins, we can change which maven repository to use (by default it is shared by the whole machine, but it can be changed to per-workspace or per-executor, etc. (In your project configuration in Build -> Advanced you can check " Use private Maven repository ", and in Manage Jenkins -> Configure System -> Maven Project Configuration you can choose how to manage the Local Maven Repository . I suspect that you changed it to" Local to Executor "

If you have any settings that cause assembly A installed in another repository used by B, you may run into a problem that you encountered.

+6
source

All Articles