Maven private server Nexus-3.49.0 configuration

Maven private server Nexus-3.49.0 configuration


Official Nexus:
https://help.sonatype.com/repomanager3/product-information/download


1. Download the Windows archive version

1.1 The official download is too slow (over the wall):

https://download.sonatype.com/nexus/3/nexus-3.49.0-02-win64.zip

1.2 Save a 123 cloud disk:

https://www.123pan.com/s/vLRrVv-od7q3.html Extraction code: 2023
download


2. Unzip

decompress

2.1 After decompression, renamed and removed -win64 (see personal preference naming)

insert image description here

2.2 Catalog introduction

introduce


3. start

3.1 Enter the bin directory

bin

3.2 Enter CMD in the address bar and press Enter to open the console

cmd

3.3 Start commandnexus /run nexus

run
Seeing this sentence means that the startup is complete

This sentence


4. Visit nexus http://localhost:8081/

access

4.1 About modifying and specifying the port number:

nexus-default.propertiesIn the files in the etc directoryetc
Revise

4.2 Adjust the parameters related to server startup such as memory and threads

nexus.vmoptionsIn the file in the bin directory
bin


5. Warehouse classification and upload

log in first
Log in

5.1 Account name and password

account password

5.2 Complete the wizard installation next step

next

5.3 Set a new login password

change Password

5.4 Whether to enable anonymous access (here I choose to disable)

no

Interpretation:paraphrase

5.5 completed

Finish

5.6 Interface Introduction

introduce

5.7 Warehouse introduction:

Warehouse classification
storehouse


6. Create a new host warehouse

6.1 Create two warehouses of release and snapshots

new build
host machine
type
create
To facilitate subsequent resource access, the仓库放入群组

put group
The configuration is as follows:

6.2 Click Group

1

6.3 Add and save, so that you can find resources in the central warehouse and our private warehouse later

Add to

According to the above 3 steps, build another xiang -snapshotswarehouse

create
add and save

Warehouse configuration complete


7. About manual resource upload

7.1 Upload steps:

resource
upload
Generate POM file
Upload succeeded:

uploaded successfully

7.2 Delete resources

If you don’t want it anymore, click on the warehouse and delete it directly

delete


8. Configure the local warehouse to access the private server

IDEA–>local–>–username/password to access private server, upload location (host address)–>private server

IDEA<–local<—username/password to access private server, download location (group address)—<–private server

8.1 Modified mavenconfiguration files settings.xmlin two places
8.1.1 About 112 servers

Configure the access permissions of the local warehouse to the private server, and add the warehouse information of two private servers , as shown in the following figure:

<!--配置访问服务器的权限,用户名密码-->
	<server>
		 <id>xiang-release</id>
     	 	<username>admin</username>
      		<password>123456</password>
	</server>
	<server>
		 <id>xiang-snapshots</id>
     	 	<username>admin</username>
      		<password>123456</password>
	</server>

account password

8.1.2 About 159 lines of mirrors

Add a private server address and configure the resource source of the local warehouse , as follows:
About private server address acquisition:

get address

<!--自定义私服-->
      <mirror>
         <id>nexus-xiang</id>
         <!--*所有东西都从这拿-->
         <mirrorOf>*</mirrorOf>
         <!--私服访问路径-->
         <url>http://localhost:8081/repository/maven-public/</url>
      </mirror>

private server address


Maven configuration complete

9. IDEA access private server and component upload

9.1 Configure pom.xml

Add configuration to IDEA's project pom.xml :

insert image description here

<!--发布配置管理-->
    <distributionManagement>
        <!--release相关的-->
        <repository>
            <!--私服release仓库-->
            <id>xiang-release</id>
            <!--去私服页面拷贝下xiang-release仓库地址-->
            <url>http://localhost:8081/repository/xiang-release/</url>
        </repository>
        <!--snapshots相关的-->
        <snapshotRepository>
            <!--私服snapshots仓库-->
            <id>xiang-snapshots</id>
            <!--去私服页面拷贝下xiang-snapshots仓库地址-->
            <url>http://localhost:8081/repository/xiang-snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

schematic diagram

9.2 Resource publishing

About publishing resources to the private server command mvn deploy
IDEA, just double-click directly

double click

9.3 view

Published resources can be viewed on the page:

resource

In this way, the order in which maven loads jar packages is to find the private server first, and then go to Alibaba Cloud to find it if the private server is not available~

10. Windows 10 boots automatically

Tested the bat file to start automatically after booting, to solve the problem of starting it manually every time the computer is turned on:

(1) Create a new txt file named NexusStart,
(2) Write the following code (note your nexus path),
(3) Change the file suffix to .bat
(4) Put it into the Windows self-starting file, the path is as follows:

C:\Users\用户名\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

bat file

@echo on
F:
cd "F:\Java\Maven\nexus\nexus-3.49.0-02\bin\"
start nexus /run nexus

Code Analysis:
Open the display of the DOS command line,
enter the F disk ,
enter the bin path of nexus, and
execute the command nexus /run nexus

Done, so that it can start automatically every time you turn on~


About the end of the configuration of Maven private server Nexus-3.49.0, thank you for reading.


END

Guess you like

Origin blog.csdn.net/qq_44870331/article/details/129579080