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.