Last active
January 22, 2020 17:46
-
-
Save mujahidk/ed3bd6ef7d9f80b69f0f965aa4138d1e to your computer and use it in GitHub Desktop.
Extract Maven dependencies into an html table structure (a hack!)
This file contains 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
// 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