0

I'm automating the deploy process of a project and one of the things that I'm struggling is to download from Bintray the latest snapshot version of a given maven artifact. This https://bintray.com/docs/api/#_dynamic_download documentation states that you should use $latest variable but all tentatives gave me a 404 error. Following is a curl sample

curl -v -H 'X-Bintray-Package: main' -utmoreira2020:mytoken 'https://bintray.com/content/liferay/myrepo/com/liferay/myproject/distribution/$latest/distribution-$latest.lpkg'

Thanks in advance

1 Answers1

2

Couple of things that can go wrong here:

  1. The dynamic content is only available for a Pro package (i.e. in a repo that belongs to a Pro user or a Pro organization).
  2. Curl treats $ as a special character, you need to escape it with \. Here's an example: curl -u jbaruch -L "https://api.bintray.com/content/jfrog-int/iot-generic-distribution/firmare-\$latest.bin?bt_package=arduino-jfrog-firmware"
  3. You are trying to download a Maven unique snapshot. This won't work because the version in the path is referred to as SNAPSHOT, while the version in the file name is the timestamp of the build. You might want something like Aritfactory's [SNAPSHOT] token, but that won't happen, because Bintray is a service for distributing releases, not development time snapshots (use Artifactory).
JBaruch
  • 22,610
  • 5
  • 62
  • 90
  • I have a Silver plan in my organization this address the first item. For the second item I'm wrapping the url with single quotes and curl -v is showing that the $latest is right. I also tried encode `$latest` with `%24latest` and the result is the same – Thiago Leão Moreira Mar 11 '16 at 18:04
  • do you have an example that works? One that uses curl to download the latest maven snapshot? – Thiago Leão Moreira Mar 11 '16 at 18:06
  • the encoding should be just `\$`. I added the example. – JBaruch Mar 11 '16 at 19:52
  • I tested with a released version and it works fine. The problem is when you are trying to download a Maven SNAPSHOT version, why? Because the $latest variable is different in the two positions of the url. A Maven SNAPSHOT path has this format com/liferay/myproject/distribution/1.0.0-SNAPHSOT/distribution-1.0.0-20160310.204308-2.lpkg so the $latest variable must have two different values. I even tried with path com/liferay/myproject/distribution/1.0.0-SNAPHSOT/distribution-1.0.0-SNAPSHOT.lpkg and the result is the same, e.g. a 404 error. – Thiago Leão Moreira Mar 11 '16 at 22:33
  • Hm, I didn't realize you are talking about actual Maven unique snapshots. In this case the answer will be "no, can't do". That's because Bintray is not intended for snapshots (development-time artifacts should be deployed to Artifactory, not Bintray). I'll update the answer. – JBaruch Mar 11 '16 at 23:00