Skip to content

Instantly share code, notes, and snippets.

@tszpinda
Created September 5, 2017 10:29
Show Gist options
  • Save tszpinda/b5f731ded97d183e3ca9e5d9070841ac to your computer and use it in GitHub Desktop.
Save tszpinda/b5f731ded97d183e3ca9e5d9070841ac to your computer and use it in GitHub Desktop.
find artifact versions in nexus and sort
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