手动上传Jar包到私服 使用 mvn deploy:deploy-file 和 目录上传

方案1

配置文件内容

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <!-- <localRepository>D:\Java\apache-maven-3.5.4\repository</localRepository> -->

  <mirrors>
  </mirrors>
  <servers>
    <server>
      <id>deploy-it</id>
      <username>jinko_maven</username>
      <password>jinko_maven</password>
    </server>
    <server>
      <id>maven-snapshot</id>
      <username>jinko_maven</username>
      <password>jinko_maven</password>
    </server>
  </servers>


  <profiles>
    <profile>
      <id>jdk-1.8</id>
      <activation>
        <!-- 默认激活 -->
        <activeByDefault>true</activeByDefault>
        <!-- 设置maven默认的 jdk 为 1.8 -->
        <jdk>1.8</jdk>
      </activation>

      <repositories>
        <!-- 配置多个仓库,多个同时生效 -->
        <repository>
          <id>deploy-it</id>
          <name>deploy-it</name>
          <url>http://xxx.xxx.xx.xx:8081/repository/xxx-it/</url>
        </repository>
      </repositories>

    </profile>

  </profiles>
</settings>

上传命令

mvn deploy:deploy-file  -s "C:\Users\xxx\.m2\deploy.xml" -DgroupId=groupId -DartifactId=artifactId -Dversion=version -Dpackaging=jar -DrepositoryId=deploy-it  -Durl='http://xxx.xxx.xx.xx:8081/repository/xxx-it/'  -Dfile=release.jar

方案2

#!/bin/bash
# copy and run this script to the root of the repository directory containing files
# this script attempts to exclude uploading itself explicitly so the script name is important
# Get command line params

while getopts ":r:u:p:" opt; do
	case $opt in
		r) REPO_URL="$OPTARG"
		;;
		u) USERNAME="$OPTARG"
		;;
		p) PASSWORD="$OPTARG"
		;;
	esac
done

find . -type f  |grep -E '*.*$'| sed "s|^\./||" | xargs -I '{}' curl -u "$USERNAME:$PASSWORD" -X PUT -v -T {} ${REPO_URL}/{} ;
## find . -type f |grep -E "*.jar"| sed "s/^.\///"| sed "s/.jar$//"| xargs -I '{}'  mvn deploy:deploy-file  -s "C:\Users\xxx\.m2\deploy.xml" -Durl='http://ip:port/repository/jk-it/'  -DgroupId=com.jinko.oa -DartifactId={} -Dversion=1.0 -Dpackaging=jar -DrepositoryId=deploy-it   -Dfile={}.jar;

jar包目录结构
在这里插入图片描述

./mavenimport.sh -u admin -p xxxx -r http://xxx.xxx.xxx.xxx:8081/repository/xxx/
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值