编程知识 cdmana.com

Deploy Maven private server

Recently I feel docker-compose What a good thing , There are as many mirrors as dependencies , It's true, a little good , For example, I found this thing very interesting Maven Private clothes

I feel this deeply , I remember leaving the first company , I want to go back and study the packaging at that time JPa frame , But download it and find , I can't pull down a lot of dependence , Although there is no way to learn , But I have to say , That frame is really powerful , Although the tables are redundant , But I think in the current business scenario, redundant tables may be faster for query , Although this is not a good point of view , I don't say much nonsense , Go straight ahead

How to build

To configure docker-compose.yml

version: '3.1'
services: 
    nexus:
        restart: always
        image: sonatype/nexus3
        container_name: nexus
        ports:
            - 8082:8081
        valumes:
            - nexus-data:/nexus-data

valumes:
	nexus-data:

start-up

$ docker-compose up -d 

Direct access http://192.168.226.128:8082, The login account and password on the Internet say that the default is admin/admin123

The actual test found that I can't log in , According to the address where we installed the data volume , View servers /var/lib/docker/volume Under the data volume nexus_nexus-data/admin.password Just take this password and you can log in , After logging in, you will change your password by default , This password will be used when uploading later

How to use

<!-- Plug-in repository  -->
<pluginRepositories>
    <pluginRepository>
        <id>nexus</id>
        <name>Nexus Plugin Repository</name>
        <url>http://192.168.226.128:8082/repository/public</url>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </pluginRepository>
</pluginRepositories>
<!-- Depending on the warehouse  --> 
<repository>
        <id>maven-resource</id>
        <name>maven-resource</name>
        <url>http://192.168.226.128:8082/repository/maven-resource/</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </repository>
</repositories>

function mven clean install You can observe the download address , Our private server warehouse will act as our agent , The priority for Local --> Private clothes --> Central factory warehouse

Private server agent finished , Will keep a copy , Next time as long as the version doesn't change , Our private servers will be preserved , Of course, your own projects can also be uploaded directly as dependencies

How to upload

modify maven Of settings.xml To configure server

<server>
    <id>nexus</id>
    <username>admin</username>
    <password> Login password of private server </password>
</server>

function mvn deploy Upload deploy Contains install,install Contains package

I don't want to use this way , You can also upload dependencies manually , direct upload Drag to upload

That's the end of private server building , Follow up update specific docker-compose and docker Specific study of , Study makes me happy , Joint efforts

Participation of this paper Tencent cloud media sharing plan , You are welcome to join us , share .

版权声明
本文为[Shao Jie]所创,转载请带上原文链接,感谢
https://cdmana.com/2021/08/20210809183600820w.html

Scroll to Top