nexus3 builds maven private server

First download the nexus3 installation package

The linux version is used here, if you need win or mac version, please Baidu
link: https://pan.baidu.com/s/11Z_884pt11l04460ldUyVA?pwd=ycuo
Extraction code: ycuo

Upload to linux server for decompression

The decompressed file directory
Insert image description here
enters the execution directory of nexus
/nexus-3.31.1-01/bin
and runs the startup command

./nexus start

Other extension commands

stop 停止服务;
restart 重启服务;
status 查看服务状态

Access the nexus management interface

The default port of nexus is 8081. Pay attention to the security group and firewall open port. You
can also modify the nexus-default.properties file in the /nexus-3.31.1-01/etc directory
to customize the port and storage path. Log
in to the system and fill in the account password
. admin , the password is obtained from the corresponding file according to the prompt
and then the password is changed

warehouse configuration

Add new warehouse

Warehouse types are divided into three
proxy remote proxy warehouses such as: Alibaba Cloud mirror
hosted local warehouse, the project's own jar package storage warehouse
group integrates remote proxy warehouse and local warehouse

After logging in, the system will automatically generate some warehouses.
If there are no special requirements, you can use the warehouses generated by the system.
However, you need to create a separate proxy warehouse to configure the Alibaba Cloud image.

Click Settings->repositories->create repository

Insert image description here

Select maven2(proxy)

Insert image description here

Fill in the information

name Custom
Proxy Routing Fill in Alibaba Cloud https://maven.aliyun.com/repository/central
and click view certificate
Other default click create
Insert image description here

Allocate proxy repository

Go back to the homepage and click on the mave-public warehouse to configure and adjust the image order.
Move the aliyun image on the left to the right, and adjust the order to the front, then save
Insert image description here
Insert image description here

Maven configuration

Dependency pull configuration

Go back to the home page and click the copy button of maven-public to get the path to the private server
Insert image description here
and then configure the local maven configuration file
. The id and name can be customized, but do not conflict with other content.

    <mirror> 
    <id>nexus</id> 
    <name>nexus maven</name> 
    <url> http://27.128.115.207:8001/repository/maven-public/</url> 
    <mirrorOf>*</mirrorOf> 
Depend on upload configuration

maven configuration file.
Add the configuration information id in the service module.
You can customize it.
Name and password are the login accounts of nexus
, but you should pay attention to whether the account has the corresponding permissions.

<server>
      <id>maven-releases</id>
      <username>admin</username>
      <password>admin111</password>
    </server>
		<server>
      <id>maven-snapshots</id>
      <username>admin</username>
      <password>admin111</password>
    </server>
pom file configuration in the project

The id and the id in maven correspond to
the name. If there is no conflict in the customization,
the url can be obtained in the corresponding version warehouse in nexus.

    <distributionManagement>
        <repository>
            <id>maven-releases</id>
            <name>Nexus Release Repository</name>
            <url>http://27.128.115.207:8001/repository/maven-releases/</url>
        </repository>
        <snapshotRepository>
            <id>maven-snapshots</id>
            <name>Nexus Snapshot Repository</name>
            <url>http://27.128.115.207:8001/repository/maven-snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

Then the idea can be packaged and uploaded by running maven normally.

Guess you like

Origin blog.csdn.net/weixin_44931584/article/details/128716249