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