1
我想在python腳本中使用maven將工件上傳到Nexus。我看着它在這裏:https://gist.github.com/adamv/705292如何使用python上的Maven上傳到Nexus
和我做了以下的方法:
def local2(command, print_command=False):
from subprocess import Popen, PIPE
p = Popen(command, stdout=PIPE, stderr=PIPE)
if print_command: print " ".join(command)
output, errput = p.communicate()
return p.returncode, output, errput
def uploadQAJavaToNexus():
url = "example"
groupId = "example"
artifactId = "example"
repositoryId = "example"
# filePath =
version = "version"
status, stdout, stderr = local2([
MAVEN_BINARY,
"deploy:deploy-file",
"-Durl=" +url,
"-DrepositoryId=" +repositoryId,
"-Dversion=" + version,
"-Dfile=" + "path"
"-DartifactId=" + artifactId,
"-Dpackaging=" + "jar",
"-DgroupId" + groupId,
])
return status, stdout, stderr
但是我卻越來越不確定的變量MAVEN_BINARY。這是什麼?
,什麼是問題? – khmarbaise
這可能是maven存儲在計算機上的路徑嗎?無論命令'mvn'是指向 – AK47
@khmarbaise我的問題基本上是如何在python腳本中運行這個(上面提到的)maven命令。 – Arshad