Not getting latest snapshot from artifactory

artifactory, sbt, scala

Solution

The problem is with the unique snapshot version that is calculated for the jar artifact. While the other artifacts get the version `2.11-1.2-20150221.064040-1` the jar artifact has a different version - `2.11-1.2-20150221.064040-2`. The root cause for this situation lies with the combination of Artifactory behavior when the repository Maven Snapshot Version Behavior is configured for unique snapshots and the way SBT deploys the artifacts. See the answer to this stackoverflow question for a good explanation of the problem. If you would like to use unique snapshots than you could:

1) Apply the solution described in the Artifactory mailing list (based on the mentioned stackoverflow question/answer) You will need to define the repository in the following way in order to pass the `build.timestamp` matrix param:

publishTo := Some("Artifactory Realm" at "http://localhost:8081/artifactory/libs-snapshot-local;build.timestamp=" + new java.util.Date().getTime)

2) Try using sbt-unique-version. It this case you will need to change the Maven Snapshot Version Behavior to "Deployer".

Problem

I am using artifactory to serve the jar files. I have `scala` projects with `SBT`. SBT is not able to resolve the latest snapshots. It is always resolving the 2nd version. I mean, if I clear the particular jar files from the `artifactory`, I need to build twice. Only then, it is getting resolved. Clearing the jars and after the first build, these are the arifacts : ``` - 1.2-SNAPSHOT - frameworks_2.11-1.2-20150221.064040-1-javadoc.jar - frameworks_2.11-1.2-20150221.064040-1-sources.jar - frameworks_2.11-1.2-20150221.064040-1.pom - frameworks_2.11-1.2-20150221.064040-2.jar - maven-metadata.xml - maven-metadata.xml ``` Even if the jar is present, not is not getting resolved in my local project. After building the framework jar once again, here is the artifactory list. ``` - 1.2-SNAPSHOT - frameworks_2.11-1.2-20150221.064040-1-javadoc.jar - frameworks_2.11-1.2-20150221.064040-1-sources.jar - frameworks_2.11-1.2-20150221.064040-1.pom - frameworks_2.11-1.2-20150221.064040-2-javadoc.jar - frameworks_2.11-1.2-20150221.064040-2-sources.jar - frameworks_2.11-1.2-20150221.064040-2.jar - frameworks_2.11-1.2-20150221.064040-2.pom - frameworks_2.11-1.2-20150221.064040-3.jar - maven-metadata.xml - maven-metadata.xml ``` After this, it is getting resolved. Now even if a make some changes are build the jar, it is always resolving from this only. None of the new changes will be getting reflected. Can someone please tell me how to fix this issue ? Because of this, I need to clear the artifactory always and build the jars twice.

Original source

Related problems