ARTIFACTORY: Why is Last-Modified header for a pom file different from virtual vs. remote-cache?
When you run a curl command against a pom file in your virtual vs. remote-cache repository, you will see that they’re different.
Case scenario
1. Create a maven remote repository “dayk-maven-remote” pointing to https://repo1.maven.org/maven2/
2. Create a maven virtual repository “dayk-libs-release” that includes the “dayk-maven-remote”
3. From a build, add a dependency. For example:
<dependency> <groupId>com.azure</groupId> <artifactId>azure-storage-blob</artifactId> <version>12.22.0</version> </dependency>
4. Once the build is run, compare the curl results.
Against the virtual repository:
❯ curl -XGET http://[ARTIFACTORY_URL]/artifactory/dayk-libs-release/com/azure/azure-storage-blob/12.22.0/azure-storage-blob-12.22.0.pom -vvv ... < Last-Modified: Tue, 02 May 2023 18:41:39 GMT
Against the remote-cache repository:
❯ curl -XGET http://[ARTIFACTORY_URL]/artifactory/dayk-maven-remote-cache/com/azure/azure-storage-blob/12.22.0/azure-storage-blob-12.22.0.pom -vvv ... < Last-Modified: Fri, 14 Apr 2023 09:49:31 GMT
Note that the last modified date is different.
This is because Artifactory has a mechanism to change the repositories section and alter some of the fields (including the Last Modified) of a pom file - of a virtual repository.
To avoid this, we can set the virtual repository settings → Advanced → Cleanup Repository References in POMs to “Nothing”.
For more information, see this page - “Cleanup Repository References in POMs”