Created
December 21, 2015 13:28
-
-
Save ericcitaire/f8b230fafb87d90de92b to your computer and use it in GitHub Desktop.
Prints the pom version
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
#!/usr/bin/env python | |
import sys | |
import xml.etree.ElementTree as ET | |
for arg in sys.argv[1:]: | |
elements = ET.parse(arg).findall("./pom:version", {'pom': 'http://maven.apache.org/POM/4.0.0'}) | |
if len(elements) == 1: | |
print elements[0].text | |
elif len(elements) == 0: | |
raise Exception('no version found') | |
else: | |
raise Exception('more than one version found') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment