赞
踩
完整结构如下:
jar
包名称
版本
jar
包
一、在服务器
opt
目录下创建一个名为localrepository
文件夹
mkdir localrepository
二、通过
Xftp
或其他传输工具将 本地Maven仓库中要上传的包 上传到服务器中上一步创建的文件夹内
三、编写shell脚本
#!/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 -not -path './mavenimport\.sh*' -not -path '*/\.*' -not -path '*/\^archetype\-catalog\.xml*' -not -path '*/\^maven\-metadata\-local*\.xml' -not -path '*/\^maven\-metadata\-deployment*\.xml' | sed "s|^\./||" | xargs -I '{}' curl -u "$USERNAME:$PASSWORD" -X PUT -v -T {} ${REPO_URL}/{} ;
四、对编写的脚本进行赋权
chmod a+x mavenimport.sh
#意思是给所有的用户添加执行 mavenimport.sh 这个文件的权限
# chmod 是添加更改权限命令
# a是指所有的用户组,包括root用户组,文件拥有者的用户组,还有其他用户组。
# +x是指添加执行权限。
# +x是执行权限,+r是阅读权限,+w是写入权限
五、执行导入命令
./mavenimport.sh -u admin -p admin123 -r http://ip:8081/repository/maven-releases/
jar
包目录结构不完整的情况,这时需要对jar
包进行规范化处理以demo-biz.jar为例:
mvn install:install-file -DgroupId=com.zhgc -DartifactId=demo-biz -Dversion=1.0.0 -Dpackaging=jar -Dfile=demo-biz.jar
出现 BUILD SUCCESS 即为构建成功
处理完之后,使用开篇的方法,上传jar包到私服
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。