Look at settings.xml (or perhaps the parent or corporate parent of the project POM) for the <repositories> element. It will look something like this.
<repositories> <repository> <id>central</id> <url>http://gotoNexus</url> <snapshots> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </snapshots> <releases> <enabled>true</enabled> <updatePolicy>daily</updatePolicy> </releases> </repository> </repositories>
Note the <updatePolicy> element. In this example, Maven accesses the remote repo (Nexus in my case, Maven Central, if you are not using your own remote repo) anytime Maven needs to get a snapshot artifact during build, checking to see if there is a new copy. This requires metadata. If there is a newer copy, Maven uploads it to the local repo.
In the example for releases, the daily policy is, therefore, it will be checked during the first build of the day. never also a valid option, as described in the Maven settings files .
Plugins are allowed separately. You can have repositories configured for them, if necessary, with various update policies.
<pluginRepositories> <pluginRepository> <id>central</id> <url>http://gotoNexus</url> <snapshots> <enabled>true</enabled> <updatePolicy>daily</updatePolicy> </snapshots> <releases> <enabled>true</enabled> <updatePolicy>never</updatePolicy> </releases> </pluginRepository> </pluginRepositories>
Someone mentioned the -o option. If you use this, Maven works offline. He knows that he has only a local repo, and he will not contact the remote repo to update artifacts no matter what update policies you use.
user944849 May 7 '13 at 17:26 2013-05-07 17:26
source share