Why sometimes artifacts are resolved from GitHub instead of Artifactory and how to resolve it

This issue occurs when a dependency is written in a shorthand-resolver format or you are trying to run bower install with this format: {owner}/{paclage} format. The default URL for this resolver is to point to GitHub. To let the resolver know that you are using Artifactory, you need to add the shorthand-resolver to the .bowerrc file in the following way:

 

“shorthand-resolver”: “art://{{owner}}/{{package}}”,

 

Each time a shorthand resolver is used, the package will be downloaded from Artifactory. For example, if the dependency is written as following format of the shorthand-resolver:

 

“javascript-detect-element-resize”: “sdecima/javascript-detect-element-resize#~0.5.1”

 

In this case, the shorthand resolver will be kicked in and the resolution will occur from Github since the default URL of the shorthand resolver is Github:

 

bower install sdecima/javascript-detect-element-resize#~0.5.1

bower javascript-detect-element-resize#~0.5.1 not-cached git://github.com/sdecima/javascript-detect-element-resize.git#~0.5.1

bower javascript-detect-element-resize#~0.5.1 resolve git://github.com/sdecima/javascript-detect-element-resize.git#~0.5.1

bower javascript-detect-element-resize#~0.5.1 download https://github.com/sdecima/javascript-detect-element-resize/archive/v0.5.3.tar.gz

bower javascript-detect-element-resize#~0.5.1 extract archive.tar.gz

bower javascript-detect-element-resize#~0.5.1 resolved git://github.com/sdecima/javascript-detect-element-resize.git#0.5.3

 

After modifying the .bowerrc file and adding the “shorthand-resolver”: “art://{{owner}}/{{package}}” line, the resolution will occur through Artifactory:

 

bower install sdecima/javascript-detect-element-resize#~0.5.1

bower javascript-detect-element-resize#~0.5.1 not-cached art://sdecima/javascript-detect-element-resize#~0.5.1

bower javascript-detect-element-resize#~0.5.1 resolve art://sdecima/javascript-detect-element-resize#~0.5.1

bower javascript-detect-element-resize#~0.5.1 resolved art://sdecima/javascript-detect-element-resize#v0.5.3

bower javascript-detect-element-resize#~0.5.1 install javascript-detect-element-resize#v0.5.3