1. 程式人生 > >基於Python自動上傳包到nexus倉庫

基於Python自動上傳包到nexus倉庫

刪除 前三 code 負責 4行 filename strip color file

1.設計思路

用戶通過excel表格的形式填寫包的信息,並將包一起發送給負責人

2.代碼實現

#coding:utf8
import os
import xlrd

def GetData(fileName):
    data = xlrd.open_workbook(fileName)
    table = data.sheets()[0]
    nrows = table.nrows - 4  #刪除後4行
    startrow = 3 #過濾前三行
    endrow = nrows 
    rowlist = []
    for i in range(startrow,endrow):
        rowlist.append(table.row_values(i,
1,7)) #print(rowlist) return rowlist def Deploy(data): for line in data: #print(line) if line[0] == ‘‘: pass else: try: jar = -Dfile= + jarpath + line[0].strip() groupId = -DgroupId= + line[3].strip() artifactId
= -DartifactId= + line[4].strip() version = -Dversion= + str(line[5]).strip() jartype = -Dpackaging=jar deployid = -DrepositoryId=release repourl = -Durl=http://xxxxx/repositories/maven-releases shellCMD = "mvn deploy:deploy-file -Dmaven.test.skip=true
" shellARG = jar + + groupId + artifactId + version +jartype + deployid +repourl os.system(shellCMD + shellARG) #print(shellCMD + shellARG) except: print(error) if __name__ == __main__: jarpath = "jar\\" fileName = uxxxxx.xlsx data = GetData(fileName) #print(data) Deploy(data)

基於Python自動上傳包到nexus倉庫