Nexus is installed on Windows, and use the nexus upload jar package

1. Introduction PW

PW is set up in a special LAN remote repository, the purpose of the proxy remote repositories and deploy third-party components. After With PW, when the need to download Maven member, direct request, PW, PW is present on the download to the local repository; otherwise, PW requests the external remote repository, download the member to the PW, and then provided to the local repository to download.

We can use a dedicated Maven repository management software to set up private servers, such as: Apache Archiva, Artifactory, Sonatype Nexus. Here we use Sonatype Nexus.

2. nexus Introduction and Installation

2.1 Introduction

Nexus Professional is required to pay.

2.2 Download

Because the test platform for the Windows platform, so download nexus-latest-bundle.zip, download at this address .

2.3 unzip

2.4 Configuration Environment Variables

2.5 Use Administrator role Open cmd, command execution

Reminded Administrator role Open cmd , otherwise when performing the install command, no permission errors will be reported.

2.6 Opening Service

2.7 Test

This nexus successful installation instructions.

3. nexus concept of

Top right, click Log In, with the username: admin, password: admin123 login, you can use more features.

3.1 Preset warehouse type

Landing Nexus, select the left menu bar Repositories, then the right of the screen will appear on the right half is listed in the repository, bold type for the group is the repository. Here briefly under several types of repository:

  • hosted, local warehouse, Normally we would deploy its own members to this type of warehouse. For example, the company's second party libraries.
  • Proxy, warehouse agent, they are used in remote proxy public repository, such as a central repository maven.
  • group, warehouse group, to combine multiple hosted / proxy warehouse, when you want to use the resources in the project do not need multiple repository is referenced multiple times, only need to refer to a group.
  • virtual: virtual warehouse

3.2 三种本地仓库

我们前面讲到类型为hosted的为本地仓库,Nexus预置了3个本地仓库,分别是Releases, Snapshots, 3rd Party. 分别讲一下这三个预置的仓库都是做什么用的:

  • Releases:
    这里存放我们自己项目中发布的构建, 通常是Release版本的, 比如我们自己做了一个FTP Server的项目, 生成的构件为ftpserver.war, 我们就可以把这个构建发布到Nexus的Releases本地仓库. 关于符合发布后面会有介绍.
  • Snapshots:
    这个仓库非常的有用, 它的目的是让我们可以发布那些非release版本, 非稳定版本, 比如我们在trunk下开发一个项目,在正式release之前你可能需要临时发布一个版本给你的同伴使用, 因为你的同伴正在依赖你的模块开发, 那么这个时候我们就可以发布Snapshot版本到这个仓库, 你的同伴就可以通过简单的命令来获取和使用这个临时版本.用来部署管理内部的快照版本构件的宿主类型仓库
  • 3rd Party:
    顾名思义, 第三方库, 你可能会问不是有中央仓库来管理第三方库嘛,没错, 这里的是指可以让你添加自己的第三方库, 比如有些构件在中央仓库是不存在的. 比如你在中央仓库找不到Oracle 的JDBC驱动, 这个时候我们就需要自己添加到3rdparty仓库。

3.3 其他仓库

Apache Snapshots: 类型为proxy仓库,用了代理ApacheMaven仓库快照版本的构件仓库 Central: 类型为proxy仓库,用来代理maven中央仓库中发布版本构件的仓库 Central M1 shadow: 类型为virtual仓库,用于提供中央仓库中M1格式的发布版本的构件镜像仓库

4. 使用nexus

4.1 覆盖中央仓库的默认地址

By default, if the warehouse can not find a local dependent component, then the local warehouse will first look for the Nexus, Nexus service is shut down if found, will be looking to the central warehouse. If we want to override the default address central warehouse, forced to rely on things to look for in Nexus, Nexus even close to the central plant would not go to download, then we need to modify the configuration file setting.xml maven in:

Large columns   installed on a Windows Nexus, and use the nexus upload jar package iv class = "highlight">
1
2
3
4
5
6
<mirror>
  <id>nexusMirror</id>
  <mirrorOf>nexus, central</mirrorOf>
  <name>Human Readable Name for this Mirror.</name>
  <url>http://127.0.0.1:8081/nexus/content/groups/public/</url>
</mirror>

Guess you like

Origin www.cnblogs.com/liuzhongrong/p/12434706.html