Bower integration with Artifactory – working with local and remote repositories

JFrog Support
2017-05-21 14:52


I will try to elaborate how the integration with Bower for both local and remote repositories works:

When deploying to local repository that declared as Bower, Artifactory would extract from the bower.json file the version and the name and would add them as properties on the package (the properties would be called and bower.version):








When you will try to resolve this package from Artifactory using the bower install command, Artifactory would search for those parameters (the and bower.version) using the properties search, after finding a package with the matching parameters, Artifactory would send the package to the client. If one of those parameters are missing, the package can not be retrieved.


When using a remote repository, the resolution behaves differently. The default Bower behaviour when resolving a Bower package is as following: First Bower would go to the bower registry to find where this package is registered. The Bower registry would return the result to the Bower client with reference to the location from where to resolve the package and then Bower would try to resolve the artifacts using the received results. When using the bower-art-resolver, the first step when Bower would try to reach the Bower registry, Bower would hit Artifactory and then Artifactory would reach the Bower registry to receive the reference for downloading the package. Artifactory would search for this information in the “gitrefs” file that can be found inside each package path:






Then Artifactory downloads the desired package and return the package to the client. The “gitrefs” file has all the versions available for this package (the information within the file constructed from the tags that are available for this specific package). This file would expiry every 10-12 hours. You can configure this time period to be lower than the default by going to the remote repository configuration ? Advanced ? Retrieval Cache Period time. When this file is not expired then Artifactory would serve the artifacts that already cached. If this file is expired then Artifactory would try to resolve from the Internet.