Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven snapshot updates

I have a maven project with a snapshot dependency. How does maven know if the snapshot needs to be updated? Does it always update? Is it time based? A checksum based update? I know I can force an update but otherwise, how does it check?

thanks, Jeff

like image 384
Jeff Storey Avatar asked Jan 27 '10 15:01

Jeff Storey


People also ask

What is update snapshot in Maven?

A Maven snapshot is a special version of a Maven package that refers to the latest production branch code. It is a development version that precedes the final release version. You can identify a snapshot version of a Maven package by the suffix SNAPSHOT that is appended to the package version.

How often does Maven check for snapshot updates?

Snapshot versions are not enabled by default. always — check for a newer version every time. daily (default value) — check for a newer version once a day. interval:mm — check for a newer version based on an interval set in minutes. never — never try to get a newer version (compared to the one we already have locally)

What does force update of snapshots releases do?

The flag of –U update snapshots will force you to check the updated snapshots and missing releases from the remote repositories. The below example shows how we can update the maven with the force option as follows. We are using the mvn clean install command with –U options for force updating.

What is the difference between snapshot and release in Maven?

A "release" is the final build for a version which does not change. A "snapshot" is a build which can be replaced by another build which has the same name. It implies that the build could change at any time and is still under active development.


2 Answers

According to the docs, the default is that it will only update once a day. That is when the first build of the day is executed. You can override this behavior with the snapshot-policy element.

  • always - always check when Maven is started for newer versions of snapshots
  • never - never check for newer remote versions. Once off manual updates can be performed.
  • daily (default) - check on the first run of the day (local time)
  • interval:XXX - check every XXX minutes

http://maven.apache.org/maven-settings/settings.html

like image 86
Christophe Herreman Avatar answered Sep 20 '22 02:09

Christophe Herreman


I have a maven project with a snapshot dependency. How does maven know if the snapshot needs to be updated?

Maven will compare the local POM's timestamp (stored in a repository's maven-metadata file) to the remote. See for example hibernate-core-3.5.0-SNAPSHOT in JBoss snapshots repository.

Does it always update? Is it time based? A checksum based update?

This depends on the updatePolicy of the repository or pluginRepository containing the snapshots. The default is a daily check (other possibles values are always, interval:X (where X is an integer in minutes) or never.

When you use SNAPSHOT internally for a project under active development, it is very common to set the <updatePolicy>always</updatePolicy> for the internal repository.

like image 35
Pascal Thivent Avatar answered Sep 20 '22 02:09

Pascal Thivent