Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change updatePolicy for my local Maven repository?

Tags:

maven

maven-3

I know how to do it for an external repository but not for my local repository, since I don't have a <repository> for my local repository in my settings.xml.

I use snapshot versions for my sub-projects, so when I re-build the parent project I want maven to get all the sub-projects snapshot versions from my local repository not only once a day (which seems to be what happens by default) but always.

like image 622
rapt Avatar asked Dec 15 '22 15:12

rapt


1 Answers

If I'm understanding your comment, I think @FrVaBe may have the correct answer. When you change code for a child project on your development machine, it's up to you to rebuild the snapshot and get it into your local artifact repo (via mvn install) so it's available for the parent project to use.

If, however, you want your parent project build to pull in changes made by your teammates and published to the corporate remote repository more often than once per day, read on.

Here is a summary of how Maven central (and kin), remote repositories (e.g a company instance of Nexus or Artifactory) and your local repository work together. If you always want the latest version of snapshots to download on every build, go into your settings.xml file, find <snapshot> repository containing the snapshot you want, and change the <updatePolicy> value to "always". Personally I rarely do this, I simply add the '-U' option to my mvn command line when I want to ensure I have the latest version of a snapshot from my remote repo.

like image 168
user944849 Avatar answered Dec 28 '22 13:12

user944849