Skip to content

Instantly share code, notes, and snippets.

Created Jan 12, 2011
What would you like to do?
builds up a classpath from a pom.xml
def build_classpath(pomfile):
Returns a string suitable for passing to java -cp by running mvn
to determine all the dependencies for the specified dependency.
handle, fname = tempfile.mkstemp()
cmd = MVN + ["-f", pomfile, "dependency:build-classpath",
"-Dmdep.outputFile=%s" % fname]
print "Resolving classpath"
f = open(fname, 'r')
jar_list = f.readline().strip()
return jar_list
def execute(command, **kwargs):
print "Executing: " + " ".join(command)
p = subprocess.Popen(command, **kwargs)
result = p.returncode
if result != 0:
raise Exception("process returned with non-zero-code")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment