Searching remote or virtual repositories, returns empty list, even if repositories contain artifacts
My project requires searching within repositories that maybe virtual or remote, that does contain artifacts.
I am using this logic: List<RepoPath> searchItems = artifactory.searches() .repositories(repoName) .artifactsByName(".") .doSearch();
to list all artifacts in the particular repo. If the repository is local this logic seems to work fine but if it is virtual or remote the search returns empty list. For virtual repository, the following property : Can Retrieve Remote Artifacts : true For remote repository, the following property : List Remote Folder Items : true
I was using version 2.6.2, but upgrading to latest version also didn't help. Is there any other setting or configuration that needs to be done?
I have the same Problem. My workaround is to list the items using HTTP requests.
/**
Get the list of items as HTML page from the Artifactory native browser and extract
the item names which can be used for recursive listing.
*/
fun Artifactory.remoteItemsList(path: String): Sequence<String> {
val htmlList = restCall(
ArtifactoryRequestImpl()
.apiUrl(path)
.method(ArtifactoryRequest.Method.GET)
.responseType(ArtifactoryRequest.ContentType.TEXT)
).rawBody
val matcher = Regex("<a href=\"([^/]+)")
return matcher.findAll(htmlList).map { it.groupValues[1] }
}