0

I do have a jenkins job that builds XML beans jar files from the internal gitlab project and puts it on the artifactory. While having a build, this XML beans jar files are downloaded to the .m2 maven local repository. However, if this jar file exists in the .m2 repository then maven does not bother to download it from the artifactory. With being said, if there is a gitlab change, it does build it and put it on the artifactory. As there is already a jar file exist in .m2 repository, an old jar file is not being replaced with the new one. We ended up a wrong dependency to the customer with a release. The question is , What am I doing wrong here?

Drew
  • 73
  • 1
  • 8
  • Did you increment the version of the new jar file? – haschibaschi May 25 '17 at 06:14
  • No! I did not update the version. I have the version i.e. 5050 and we make a change to this jar file once in a while. Once we make change, we dont want to go back to older ones so never cared to manage different versions. I expect it to overwrite whenever maven runs. Am I expecting a wrong behavior? – Drew Jun 05 '17 at 17:58
  • Its not a good pattern to change an artifact and rebuild it with the same version, the version should increment if the artifact changes. An exception to that is, when you work with snaphots. If you don't work with snapshots, maven will not download the artifact again with the same version. – haschibaschi Jun 07 '17 at 13:19
  • @haschibaschi Thanks for the reply. I see the problem now. I am about to test a solution given the answer below. Do you think what has been mentioned below can solve the problem even if I keep doing what I am doing right now. -U flag is going to force overwrite the dependencies? – Drew Jun 12 '17 at 23:35

1 Answers1

0
mvn clean install -U

-U means maven will force update snapshot dependencies. Release dependencies can't not be updated this way.

Vandit Upadhyay
  • 315
  • 3
  • 8
  • you mean to say, once I have a dependency downloaded to the local repository, it will never update on its own without -U flag/switch? – Drew Jun 05 '17 at 17:59