ChrisG29
ChrisG29

Reputation: 1571

Artifactory retrieve latest and ignore maven-metadata.xml

I'm trying to retrieve the latest version of a artifact from artifactory, but there is a file "maven-metadata.xml" in the target directory that is always being returned.

Is there a way for the request to exclude the file? My current request looks as follows:

"https://artifactory/api/storage/pathtodirectory?lastModified"

This returns the maven-metadata.xml file, I tried modifying the request to:

"https://artifactory/api/storage/pathtodirectory?lastModified?archiveType!=xml"

But that didn't exclude the file.

Upvotes: 0

Views: 789

Answers (1)

Eyal Ben Moshe
Eyal Ben Moshe

Reputation: 2435

You have the option of retrieving the latest artifact which was modified, while also excluding patterns of files, using JFrog CLI. Here's how you do it:

jfrog rt s repo-name/path/to/directory/ --sort-by modified --sort-order desc --limit 1 --exclusions "*maven-metadata.xml"

Notice that the source path argument ends with a slash (...directory/), to indicate that yuo wish to retrieve the content of the directory folder in Artifactory. You can modify the source path argument and also the value of the --exclusions option to include wildcards, and also change the value of the --limit option to return the X last modified artifacts. Once you're satisfied with the output, and you want to download the artifact, simply replace jfrog rt s with jfrog rt dl.

Upvotes: 1

Related Questions