码迷,mamicode.com
首页 > 编程语言 > 详细

基于Python自动上传包到nexus仓库

时间:2018-11-15 17:06:55      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:ble   tab   int   jar   sys   row   repos   python   utf8   

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仓库

标签:ble   tab   int   jar   sys   row   repos   python   utf8   

原文地址:https://www.cnblogs.com/mascot1/p/9964206.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!