Our maven projects all build on a jenkins and then deploy the artifacts to a maven repository.
For some reason however there seems to be some kind of cache or update lag when building a project that has dependencies to other projects that just got newly build.
Say there’s a bug in artifact A and B depends on A. Now I fix the bug locally, update my dependencies in B, run B and everything’s fine. I check in obviously. Now I build A on Jenkins and afterwards B. I then get the newly built B and run it. The bug is still there. Hours later if I build B again it will kindly get the new A and the bug is gone..
So there must be a way to force jenkins to use the new A on its server. using mvn -u or mvn --update-snapshots will not help. It will check for updates and find none..
I believe there is no such caching behavior possible in Maven/Jenkins, as all your snapshot is built locally in the same instance of Jenkins. There is no need for the “update snapshot” option because you are not getting it from remote repo. However, I would recommend you to take a look in the repository setting in Jenkins. In Jenkins, we can change which maven repository to use (by default, it is shared by whole machine, but it can be changed to per-workspace or per-executor etc. (Under your project configuration, in
Build -> Advanced, you can check for “Use private Maven repository“, and inManage Jenkins -> Configure System -> Maven Project Configuration, you can select the way to manageLocal Maven Repository. I am suspecting you have changed it to “Local to executor”If you have any setting that cause the build of A installed in a different repository that B use, you may hit problem you faced.