Created
September 5, 2017 10:29
-
-
Save tszpinda/b5f731ded97d183e3ca9e5d9070841ac to your computer and use it in GitHub Desktop.
find artifact versions in nexus and sort
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def url = '.../maven-metadata.xml' | |
def metadataText = "curl ${url}".execute().text | |
def parser = new XmlParser(); | |
def xml = parser.parseText(metadataText); | |
def versions = [] | |
xml.'**'.version.each { v -> | |
versions.add(v.text()) | |
} | |
println versions.findAll{ v -> !v.contains('.') && v.startsWith('1') }.collect { v -> v as int }.sort().reverse() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment