docker Quick Install Maven repository

Search Mirror

[root@x-test1 nexus-data]# docker search nexus
NAME                                         DESCRIPTION                                     STARS               OFFICIAL            AUTOMATED
sonatype/nexus3                              Sonatype Nexus Repository Manager 3             571
sonatype/nexus                               Sonatype Nexus                                  411                                     [OK]
sonatype/docker-nexus3                       Sonatype Nexus 3 [DEPRECATED]                   34                                      [OK]
clearent/nexus                                                                               21
sonatype/nexus-iq-server                     Sonatype Nexus IQ Server                        13

Download image

docker pull sonatype/nexus3

Configuring the host maven directory, and set permissions

mkdir /opt/nexus-data && chmod -R 777 /opt/nexus-data

Start container

[root@x-test1 nexus-data]# docker run -d -p 8081:8081 -p 8082:8082 -p 8083:8083 --name nexus3 -v /opt/nexus-data:/nexus-data --restart=always sonatype/nexus3

View the process

[root@x-test1 nexus-data]# docker ps
CONTAINER ID        IMAGE                            COMMAND                  CREATED              STATUS              PORTS                                                NAMES
82e64960f143        sonatype/nexus3                  "sh -c ${SONATYPE_DI…"   About a minute ago   Up 50 seconds       0.0.0.0:8081-8083->8081-8083/tcp                     nexus3
e0f58344bd90        adminer                          "entrypoint.sh docke…"   2 weeks ago          Up 2 weeks          0.0.0.0:8080->8080/tcp                               adminer
c9a307eced44        redis:3.2                        "docker-entrypoint.s…"   3 weeks ago          Up 3 weeks          0.0.0.0:6379->6379/tcp                               quizzical_edison
c84184bb6010        wurstmeister/kafka:0.10.1.0      "start-kafka.sh"         4 weeks ago          Up 5 days           0.0.0.0:9092->9092/tcp                               kafka
ef06c4d4de64        hlebalbau/kafka-manager:stable   "/kafka-manager/bin/…"   4 weeks ago          Up 4 weeks          0.0.0.0:9001->9000/tcp                               kafka_manager
da30075ff138        wurstmeister/zookeeper           "/bin/sh -c '/usr/sb…"   4 weeks ago          Up 4 weeks          22/tcp, 2888/tcp, 3888/tcp, 0.0.0.0:2181->2181/tcp   zookeeper
921db0aac429        mysql:5.6                        "docker-entrypoint.s…"   5 weeks ago          Up 5 weeks          0.0.0.0:3306->3306/tcp                               mysql5.6
[root@x-test1 nexus-data]#

View Log

docker logs 82e64960f143

Log console

```
http://172.16.4.46:8081/

user:admin
passwd:admin123
```

Red box is a remote warehouse agent, which is not the local warehouse jar, will be downloaded by remote warehouse, where we set download from Ali warehouse

The following figure first red box to access the address of the warehouse, which is the repository of our configured in the pom file; the second red box represents by

http://172.16.4.46:8081/repository/maven-public能够访问的仓库,这里把自己配置的仓库都勾选进来,默认情况下会有三个默认值

Create a local user

Upload jar testing, building a maven project, pom file configuration is as follows

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.hhz</groupId>
    <artifactId>presto-jdbc</artifactId>
    <version>1.1.0-SNAPSHOT</version>


    <distributionManagement>
        <repository>
            <id>nexus-releases</id>
            <url>http://172.16.4.46:8081/repository/maven-releases/</url>
        </repository>
        <snapshotRepository>
            <id>nexus-snapshots</id>
            <url>http://172.16.4.46:8081/repository/maven-snapshots/</url>
        </snapshotRepository>
    </distributionManagement>


</project>

Configuring $ MAVEN_HOME / conf / settings.xml, user names and passwords are created before, id be consistent with the pom file

<server>
   <id>nexus-releases</id>
   <username>test_user</username>
   <password>123456abc</password>
</server>

<server>
   <id>nexus-snapshots</id>
   <username>test_user</username>
   <password>123456abc</password>
</server>

Upload jar

mvn deploy

Packaged before searching presto-jdbc coordinates

Create a new Maven project, jar, pom documents submitted before accessing the download below

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.mv</groupId>
    <artifactId>mvtest</artifactId>
    <version>1.0-SNAPSHOT</version>

    <repositories>
        <repository>
            <id>maven-central</id>
            <name>maven-central</name>
            <url>http://172.16.4.46:8081/repository/maven-public/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <releases>
                <enabled>true</enabled>
            </releases>
        </repository>
    </repositories>

    <dependencies>

        <dependency>
            <groupId>com.hhz</groupId>
            <artifactId>presto-jdbc</artifactId>
            <version>1.1.0-SNAPSHOT</version>
        </dependency>
    </dependencies>

</project>

End

Published 118 original articles · won praise 37 · views 170 000 +

Guess you like

Origin blog.csdn.net/woloqun/article/details/88825552