Created
September 10, 2019 09:20
-
-
Save redigaffi/6948ab891fcc8c79506800f59c3312bb to your computer and use it in GitHub Desktop.
Human readable list of Java dependencies
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
import xml.etree.ElementTree as ET | |
root = ET.parse('/home/jordi/IdeaProjects/backendapi/pom.xml').getroot() | |
dependencies = root.findall('*/{http://maven.apache.org/POM/4.0.0}dependency') | |
dependency_list = {} | |
for dependency in dependencies: | |
groupId = dependency.find('{http://maven.apache.org/POM/4.0.0}groupId').text | |
artifact = dependency.find('{http://maven.apache.org/POM/4.0.0}artifactId').text | |
try: | |
dependency_list[groupId].append(artifact) | |
except: | |
dependency_list[groupId] = [] | |
dependency_list[groupId].append(artifact) | |
for key, value in dependency_list.items(): | |
print(key+": ") | |
for i in range(len(value)): | |
print("\t-"+value[i]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment