Observation:
I was testing how Maven retrieves artifacts when building artifacts using mvn package
(or) mvn install
command. I noticed that Maven was connecting to the Internet to get the dependencies every single time. There was not much time gap (maybe around 1 or 2 minutes) between successive runs as well.
Question:
Therefore, if Maven connects to Internet (or the repository provided in my settings.xml
) every time by default, why do they have a separate attribute that can force update (The -U
attribute which is used like this: mvn install -U
of a snapshot from the repo? What is the factor that governs/decides between connecting to an external repo or using local repo for retrieving dependencies?
Reference: (Please refer http://www.sonatype.com/node/158?file=books/maven-definitive-guide.pdf Page 93 to know more about this attribute). The reference just explains about the attribute but the governing principle behind it is not explained.