Nexus builds Maven local repository

Source: Internet
Author: User
Tags maven central

Read Catalogue
    • Order
    • Nexus

Order

There may be some development machines in the work can not be Internet access, a large number of machines to obtain jar package will cause the company network is slow, and when the company will release its own version of the project, other projects may rely on the reference, so you need to use MAVEN's local warehouse.

Here's how to build a local maven repository.

Nexus
One: Introduction

Nexus is Maven's warehouse manager, used to build a local warehouse server, so that the benefits of easy management, save network resources, speed, through the snapshot version control, open the module between the efficient dependency development.

Two: Download

We'll get the latest version from http://nexus.sonatype.org/downloads/. The Nexus-2.12.0-01-bundle.zip is used here.

Three: Decompression

After extracting to local directory structure.

We can see Nexus.bat in the bin. By the time we can use this command lai an loading and unloading, start to stop the Nexus service.

Four: Configure environment variables

Because it was developed in Java. So you need to install the JDK, and configure the Java environment variables, this is not the table.

New environment variable Nexus

The value is the extracted directory F:\nexus-2.12.0-01\

Add to the path;%nexus%\bin

Can see

So you can. We can see the command: Start,stop and so on.

Five: Install the service, start the service

Let's install the service first.

Nexus.bat Install

This will allow installation and prompt installation. We can start the service.

Nexus.bat start

After the prompt is successful we can enter 127.0.0.1:8081/nexus to access.

VI: Use

In the upper right corner there is a log in. Click this to log in. Username is Admin password default is admin123

After logging in, click Repositories on the left Views/repositores

 

Hosted: A local repository, usually we deploy our own artifacts to this type of warehouse. such as the company's second-party library.
Proxy: The broker repository, which is used to proxy remote public repositories, such as the MAVEN central repository.
Group: Warehouse Group, used to consolidate multiple hosted/proxy warehouses, when your project wants to use resources in multiple repository, it does not need to reference multiple times, just need to refer to a group.

Central: It's Maven's center warehouse, and here's the example.

Select the type of warehouse

Repository Policy is release or snapshot

Download Remote Index file

Click the central repository, then click Configration. Change the download Remote indexes to True to save.

Because the index is relatively large, it will take a while to download.

The routing option can see the status of the current warehouse and the remote warehouse. and set the update frequency.

Put the set up warehouse in the warehouse group.

Click Public repositories->configuration

Put central to the left.

Click Browse Index and we can see a lot of resources in the warehouse.

Configure MAVEN to open the \apache-maven-3.3.3\conf\settings.xml configuration file.

The <mirror> node is configured as follows

  <mirrors>    <!--mirror     | Specifies a repository mirror site to use instead of a given repository. The repository that | This mirror serves have an ID, that matches, the     mirrorof element of this mirror. IDs is used     | For inheritance and direct lookup purposes, and must is unique across the set of mirrors.     |-->< c6/><mirror>      <id>nexus</id>      <mirrorOf>*</mirrorOf>      <name>human Readable Name for this mirror.</name>      <url>http://127.0.0.0:8081/nexus/content/groups/public/< /url>    </mirror>      </mirrors>

We can use this configuration to the local repository in Elipse.

Nexus builds Maven local repository

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.