Teach you how to build a private server (Nexus)

The private server is an independent server, which is used to solve the problem of resource sharing and resource synchronization within the team.

1.Nexus

Nexus is a maven private server product of sonatype company.

1.1 Download address

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

1.2 start

nexus.exe /run nexus

insert image description here

1.3 Access & Login

insert image description here

2. Private server warehouse classification

insert image description here
insert image description here

3. Resource upload and download

insert image description here

Local warehouse upload and access resources need to be configured.

①Create two warehouses demo-snapshot and demo-release

insert image description here

② Configure the permission to access the private server

insert image description here

<servers>
  <!--配置访问私服权限-->
  <server>
      <id>demo-snapshot</id>
      <username>admin</username>
      <password>root</password>
  </server>
  <server>
      <id>demo-release</id>
      <username>admin</username>
      <password>root</password>
  </server>
</servers>

③ Configure private server access path

Still configured in the setting.xml file

<mirrors>
    <!--私服的访问路径-->
    <mirror>
      <id>maven-public</id>
      <mirrorOf>*</mirrorOf>
      <url>http://localhost:8081/repository/maven-public/</url>
    </mirror>
 </mirrors>

The configuration information is consistent with the maven-group warehouse group in the figure below, and the demo-snapshot and demo-release warehouses are added to the warehouse group.
insert image description here

④ Configure the specific location of the private server in the demo_aggregate project of the above article (pom.xml file)

<distributionManagement>
    <snapshotRepository>
        <id>demo-snapshot</id>
        <url>http://localhost:8081/repository/demo-snapshot/</url>
    </snapshotRepository>
    <repository>
        <id>demo-release</id>
        <url>http://localhost:8081/repository/demo-release/</url>
    </repository>
</distributionManagement>

⑤Upload
insert image description here

check it out
insert image description here

Guess you like

Origin blog.csdn.net/weixin_39570655/article/details/132231584