Use this blog docker install maven PW, and package your own code uploaded to the PW.
Description: I am writing this blog post for two main reasons: First, the easy access to I, II, and want to learn for the whole white micro inspection service of friends. The following mainly from Yu Shengjun video, I will be refined on the basis of his steps so white can understand, please also reproduced at the time of the introduction Yu Shengjun link
1, the installation docker
View 1.1 is installed docker:
Entering linux server : Enter the following command , if the installation does not show the corresponding port
yum list installed | grep docker
1.2 Installation docker
yum -y install docker
After installation is complete check the running View docker command
2. Start docker
systemctl start docker
2.1. View docker state
systemctl status docker
3. Download nexus3 mirror
3.1. Installation nexus3
docker pull sonatype/nexus3
The following error occurs if you restart the docker
service docker restart
- 将容器内部/var/nexus-data挂载到主机/root/nexus-data目录。
docker run -d -p 8081:8081 --name nexus -v /root/nexus-data:/var/nexus-data --restart=always sonatype/nexus3
查看容器信息
docker ps
3.1. Docker相关命令
Docker inspect 容器id 查看容器信息
Docker stop 容器id 停止容器id
Docker rm 容器id 删除容器id
Maven私服启动容器稍微比较慢,等待1分钟即可
关闭防火墙,访问http://ip:8081
4. 登录maven私服
4.1查看默认密码
输入以下命令查找该文件的位置
find / -name 'admin.password'
进入data文件夹下
cd /var/lib/docker/volumes/fc3e155d5834df70ecad085aabc361628916670997aee210e03215f3afef475e/_data/
查看密码:
4.2登录maven私服,进入后更改密码为:admin123
5.创建自己的repostitories
登录进入首页后,步骤如下:
6、查看maven环境配置地址
在本地进入控制台输入mvn -version
进入该文件夹下找到setting.xm文件,增加以下代码:
<server> <!-- 自定义一个serverid 名称--> <id>cyb</id> <!--maven私服登录的用户名 --> <username>cyb</username> <!--配置的maven私服登录密码--> <password>cyb</password> </server>
在需要导入maven私服的项目中,进入pom文件,增加以下代码
<!--注意限定版本一定为RELEASE,因为上传的对应仓库的存储类型为RELEASE --> <!--指定仓库地址 --> <distributionManagement> <repository> <!--此名称要和.m2/settings.xml中设置的ID一致 --> <id>cyb</id> <url>http://192.168.1.172:8081/repository/one-release/</url> </repository> </distributionManagement> <build> <plugins> <!--发布代码Jar插件 --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> <version>2.7</version> </plugin> <!--发布源码插件 --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <version>2.2.1</version> <executions> <execution> <phase>package</phase> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> </plugins> </build>
/
7 import maven PW
Enter the command: mvn Deploy the jar package into maven PW in
Solution:
SNAPSHOT or replace RELEASE
Description uploaded successfully
Other projects also upload similar child-parent program to upload is dependent on the project, and then upload dependent projects. Like a friend to my blog my blog, my blog address is: https://www.cnblogs.com/chenyuanbo/