一、nexus的环境变量(默认)
image.png所以,我们一般会把NEXUS_DATA目录持久化,在这里,我们还需要对NEXUS_HOME目录也持久化。
image.png
二、上传bundle.kar文件
因为nexus-repository-composer-0.0.10-bundle.kar 文件是存放在目录/opt/nexus/deploy下。
[root@maven3 deploy]# pwd
/opt/nexus/deploy
[root@maven3 deploy]# ll
总用量 724
-rw-r--r-- 1 root root 737537 12月 13 17:42 nexus-repository-composer-0.0.10-bundle.kar
下载地址见:https://search.maven.org/artifact/org.sonatype.nexus.plugins/nexus-repository-composer/0.0.10/bundle
三、nexus的安装
修改docker-compose.yml内容,增加- /opt/nexus:/opt/sonatype/nexus:Z
version: '3'
services:
nexus:
restart: always
image: sonatype/nexus3
container_name: nexus3
ports:
- 8081:8081
- 8082:8082
- 8083:8083
- 8084:8084
- 8085:8085
volumes:
- /opt/nexus:/opt/sonatype/nexus:Z
- /data/nexus-data:/nexus-data:Z
在重启前,稳妥起见先把容器里的目录拷贝到持久化目录。
docker cp 168ae2109cf8:/opt/sonatype/nexus/ /opt/nexus/
(其中168ae2109cf8为容器ID)
- 先停止,docker-compose down
- 再启动,docker-compose up -d
四、重启Nexus
在Bundles列表,可以看到你所安装的composer版本。
image.png五、安装成功的效果
image.png六、遇到的问题
- 版本不一致捯饬的报错
我的Sonatype Nexus Repository ManagerOSS的版本是3.37.3-02,第一次我是按照composer的最新稳定版0.0.29,报错如下:
2022-12-13 09:35:06,312+0000 ERROR [features-2-thread-1] *SYSTEM java.lang.Throwable - org.apache.felix.resolver.reason.ReasonException: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=nexus-repository-composer; type=karaf.feature; version="[0.0.29,0.0.29]"; filter:="(&(osgi.identity=nexus-repository-composer)(type=karaf.feature)(version>=0.0.29)(version<=0.0.29))" [caused by: Unable to resolve nexus-repository-composer/0.0.29: missing requirement [nexus-repository-composer/0.0.29] osgi.identity; osgi.identity=org.sonatype.nexus.plugins.nexus-repository-composer; type=osgi.bundle; version="[0.0.29,0.0.29]"; resolution:=mandatory [caused by: Unable to resolve org.sonatype.nexus.plugins.nexus-repository-composer [256](R 256.0): missing requirement [org.sonatype.nexus.plugins.nexus-repository-composer [256](R 256.0)] osgi.wiring.package; (&(osgi.wiring.package=com.fasterxml.jackson.core.type)(version>=2.13.0))]]
所以我把bundle的版本降低至0.0.10
网友评论