Skip to content

Instantly share code, notes, and snippets.

@mujahidk
Last active January 22, 2020 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mujahidk/ed3bd6ef7d9f80b69f0f965aa4138d1e to your computer and use it in GitHub Desktop.
Save mujahidk/ed3bd6ef7d9f80b69f0f965aa4138d1e to your computer and use it in GitHub Desktop.
Extract Maven dependencies into an html table structure (a hack!)
// mvn dependency:list | egrep -i 'mujahidk'
def output = "mvn dependency:list | egrep -i 'mujahidk'".execute().text
print '%html '
println '<table>'
output.split("\r\n").each { line ->
def result = line ==~ /\[INFO\]\s+(([\w\-\.])*:){3,6}.*/
if(result) {
print '<tr>'
def matched=line.replaceFirst(/\[INFO\]\s+/, '')
groups = matched =~ /(?<groupId>[\w\-\.]*):(?<artifactId>[\w\-\.]*):(?<type>[\w\-\.]*):(?<version>.*):(?<scope>[\w\-\.\s\(\)]*)/
groups.matches()
print "<td>${groups.group('groupId')}</td>"
print "<td>${groups.group('artifactId')}</td>"
print "<td>${groups.group('type')}</td>"
print "<td>${groups.group('version')}</td>"
print "<td>${groups.group('scope')}</td>"
println '</tr>'
}
}
println '</table>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment