打开网站News and Notes from the makers of Nexus | Sonatype Blog
选择菜单 Product-->Nexus Repository OSS,填写好内容后点击下载
选择你要下载的版本,我这里选择第3个
选择Docker 部署的话如下:
创建本地挂载目录 /docker/nexus-data
给予权限 chmod -R 777 nexus-data
运行命令
docker run -d -p 8081:8081 --name nexus -v /docker/nexus-data:/nexus-data sonatype/nexus3
启动过程可能需要几分钟,查看日志 docker logs -f nexus
初始密码在/docker/nexus-data/admin.password 用户名为 admin
批量导入jar脚本:
#!/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}/{} ;
在要导入jar的目录(不能在父节点目录,否则groupid会有父节点目录名称)执行以上脚本
命令如下:./import.sh -u admin -p xxx -r http://xx.xx.xx.xx:9081/repository/my_repos/
导入完成后如下图: