clj2nix icon indicating copy to clipboard operation
clj2nix copied to clipboard

SNAPSHOT versions looks in the wrong place

Open terlar opened this issue 5 years ago • 5 comments

I stumbled upon https://clojars.org/kitchen-async/versions/0.1.0-SNAPSHOT

Which will generate:

  {
    name = "kitchen-async";
    path = pkgs.fetchMavenArtifact {
      inherit repos;
      artifactId = "kitchen-async";
      groupId = "kitchen-async";
      sha512 = "0d6f8ce7b94b538e00e4a6719362dfe121b0db303906f46b638943c087ac1861442ea4896211110a06a01ecd5fab44dc7deb3b26d918c263be18751ff783492c";
      version = "0.1.0-SNAPSHOT";
    };
  }

This will look for: https://repo.clojars.org/kitchen-async/kitchen-async/0.1.0-SNAPSHOT/kitchen-async-0.1.0-SNAPSHOT.jar

However, the resulting artifact won't exist: https://repo.clojars.org/kitchen-async/kitchen-async/0.1.0-SNAPSHOT/

Seems if you provide the url attribute to the artifact it will work.

terlar avatar Nov 27 '20 00:11 terlar

Thanks for this report, I've been looking into it. The SNAPSHOT is a wildcard which maven modifies to the latest timestamp of the given SNAPSHOT release. I'll see if I can find some lower lever tooling to tap into the resolver. But speaking with some of the tools.deps devs (Alex Miller), it seems this functionality isn't handled there at all.

hlolli avatar Dec 16 '20 13:12 hlolli

I see, that sounds very tricky to solve then. If it is possible to gather this information, I am quite sure it will require some further modifications to fetchMavenArtifact.

And you would pass something like:

{
  artifactId = "kitchen-async";
  groupId = "kitchen-async";
  sha512 = "0d6f8ce7b94b538e00e4a6719362dfe121b0db303906f46b638943c087ac1861442ea4896211110a06a01ecd5fab44dc7deb3b26d918c263be18751ff783492c";
  version = "0.1.0-SNAPSHOT";
  snapshot = "20191108.004735-9";
}

Which would look for a URL like:

https://repo.clojars.org/kitchen-async/kitchen-async/0.1.0-SNAPSHOT/kitchen-async-0.1.0-20191108.004735-9.jar

I guess the logic would be if snapshot is provided, replace SNAPSHOT in the artifact name with the value of attribute snapshot.

terlar avatar Dec 16 '20 18:12 terlar

that's an idea, not bad.

hlolli avatar Dec 16 '20 18:12 hlolli