部署 nexus3
通过docker运行 nexus3 服务
docker run -d -p 8081:8081 --name nexus -v nexus-data:/nexus-data sonatype/nexus3
服务启动后通过 http://ip:8081 访问 nexus3 ,默认密码在容器内通过 cat /nexus-data/admin.password
获取。
Maven 私服配置
-
创建nexus仓库
- 仓库类型maven2(hosted)
- Version policy: Mixed
- Deployment policy: Allow redploy
- 其余默认即可
-
向 nexus 仓库上传依赖
-
有网环境下下载依赖包
在代码主目录内(pom.xml所在目录)执行以下命令mvn dependency:copy-dependencies mvn clean install -U
-
将下载好的依赖包(默认位于
~/.m2/repository
内)拷贝到可以上传的服务器上,执行以下命令上传,脚本内容如下./mavenimport.sh -u admin -p admin -r http://nexusurl/repository/my_maven
#!/bin/bash while getopts ":r:u:p:" opt; do case $opt in r) REPO_URL
-