Reputation: 759
I recently set up a password protected Artifactory server. A Jenkins server is deploying my artifacts to a maven repository on that Artifactory server.
Here is the problem:
The new builds are nor available at runtime (in IntelliJ) neither in Maven (when building). To get maven to update, I've to delete the artifacts from my local repo.
How can I tell Maven/IntelliJ to always check for the newest version?
Even that wasn't doing anything:
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
Upvotes: 3
Views: 8224
Reputation: 22893
There are the cases to deal with:
~/.m2/
repository cache for Maven or remote repository cache for Artifactory). The only way to force Artifactory and Maven to re-fetch a release artifact is to delete it from the cache. Do not use the same version for different blob, ever.-SNAPSHOT
and thus they violate the rule I just wrote, so don't use them), their retrieval policy is the same: Maven consider them expirable resources, it will occasionally check for a new blob, posted under the same version. Artifactory does the same: occasionally the expirable resource is declared "expired", so next time Maven asks for this resource, Artifactory will fetch to the remote repository to check for a new blob, posted under the same version. In both tools you can control the cache period and "zap the cache" manually.
<update-policy/>
controls how often Maven checks for new snpashots, and the --update-snapshots
flag forces Maven to check immediately.Retrieval Cache Period
parameter in remote repository configuration controls how often Artifactory checks for new snapshots, and the Zap Caches
action on the remote repository in the artifact browser screen makes sure that Artifactory will check for new snapshots on the next request.Upvotes: 4