Search code examples
bintray

Unable to download snapshot artifacts using curl from bintray.com


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


Solution

  • 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).