简体   繁体   中英

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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM