tôi có hệ điều hành Linux và tôi không có quyền truy cập vào API REST, vì vậy tôi sử dụng lệnh sau đây để có được phiên bản mới nhất của bức ảnh chụp từ Nexus:
Một ví dụ ảnh chụp nhanh maven-metadata.xml từ kho WSO2:
$ curl -s "http://maven.wso2.org/nexus/content/repositories/snapshots/org/wso2/is/wso2is/maven-metadata.xml"
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>org.wso2.is</groupId>
<artifactId>wso2is</artifactId>
<versioning>
<latest>5.3.0-SNAPSHOT</latest>
<release></release>
<versions>
<version>5.1.0-SNAPSHOT</version>
<version>5.2.0-SNAPSHOT</version>
<version>5.3.0-SNAPSHOT</version>
</versions>
<lastUpdated>20160914062755</lastUpdated>
</versioning>
</metadata>
Extracting từ thẻ XML mới nhất bên trong maven-metadata.xml:
curl -s "http://maven.wso2.org/nexus/content/repositories/snapshots/org/wso2/is/wso2is/maven-metadata.xml" | \
grep "<latest>.*</latest>" | \
sed -e "s#\(.*\)\(<latest>\)\(.*\)\(</latest>\)\(.*\)#\3#g"
Trích xuất từ phiên bản thẻ XML bên trong maven-metadata.xml:
curl -s "http://maven.wso2.org/nexus/content/repositories/snapshots/org/wso2/is/wso2is/maven-metadata.xml" | \
grep "<version>.*</version>" | \
sort | uniq | tail -n1 | \
sed -e "s#\(.*\)\(<version>\)\(.*\)\(</version>\)\(.*\)#\3#g"
Kết quả của cả hai lệnh đến ngày hôm nay ngày 14 tháng 9 năm 2016 là:
5.3.0-SNAPSHOT
Nguồn
2016-09-14 08:02:32
có thể trùng lặp [Sử dụng API nghỉ ngơi Nexus để lấy phiên bản tạo tác mới nhất cho nhóm/artficatid nhất định] (http: // stac koverflow.com/questions/7911620/using-the-nexus-rest-api-to-get-latest-artifact-version-for-given-groupid-artfic) –