3
votes

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>
1
please provide an example or artifacts that you deploy. Are they snapshots or releases that you override?JBaruch
@JBaruch both, also i set Artifactory's 'Maven Snapshot Version Behavior" to "Non-unique".Jofkos
examples of artifacts, please. We need the names of the artifacts.JBaruch
@JBaruch "Networking-1.0-SNAPSHOT.jar" for example.Jofkos

1 Answers

4
votes

There are the cases to deal with:

  1. Releases. Not Maven nor Artifactory will never check for a newer binary if a release binary of the same version exists in the local cache (~/.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.
  2. Snapshots. Although there is a difference between unique (file names end with timestamps) and non-unique (file names end with -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.
    • In Maven <update-policy/> controls how often Maven checks for new snpashots, and the --update-snapshots flag forces Maven to check immediately.
    • In Artifactory the 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.