The problem is that snapshot dependencies at local repository are synced with remote repository once per day by default. That means that if more than one version of the same artifact used as a snapshot dependency is deployed to remote repository, your local repository doesn't contain up-to-date version by default.
Here is a maven documentation snippet about that - Repositories:
updatePolicy: This element specifies how often updates should attempt to occur. Maven will compare the local POM's timestamp (stored in a repository's maven-metadata file) to the remote. The choices are: always, daily (default), interval:X (where X is an integer in minutes) or never.
I.e. default policy is to sync snapshot dependency once per-day.
However, that can be changed easily by setting update policy to 'always':
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>mycompany</id>
<name>MyCompany repository</name>
<url>https://mycompany.com/content/repositories/mycompany</url>
</repository>
<repository>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
<id>mycompany-snapshot</id>
<name>MyCompany snapshot repository</name>
<url>https://mycompany.com/content/repositories/mycompany-snapshot</url>
</repository>
</repositories>

No comments:
Post a Comment