MAVEN Warehouse-nexus Environment construction and brief introduction

Source: Internet
Author: User
Tags maven central

1. Environment Construction1.1 Downloads

http://www.sonatype.org/nexus/

NEXUS oss [OSS = open source software, open source software--free]

NEXUS Professional-free TRIAL [Professional version-charge].

So choose Nexus OSS

    


Locate the download Andinstall Nexus OSS. You can download the zip:

       

 

1.2 Configuration

Unzip the downloaded zip package to get the following directory:

    


Add the Bin directory of the Nexus to the PATH environment variable:

    


To associate the Nexus with the JDK currently in use, modify the following configuration file, directory,

${nexus_home}/bin/jsw/conf/wrapper.conf. Such as:

    


By this configuration, you can then access the Nexus locally, indicating that the configuration was successful as it appears:

    


2. The warehouse in Nexus
2.1 Type Introduction

Login nexus, select Repositories in the left menu bar, then appear on the right side of the screen, the upper right half is listed repository, boldface is the type group repository.

Here is a brief description of the following types of repository:

? Hosted, a local repository, usually we deploy our own artifacts to this type of warehouse. such as the company's second-party library.

? Proxies, which are used to proxy remote public repositories, such as the MAVEN central repository.

? Group, warehouse groups, are used to consolidate multiple hosted/proxy warehouses, and when your project wants to use resources in multiple repository, you don't need to refer to them multiple times, just refer to a group.

    


2.2 Managing local warehouses

Before we talked about the type hosted for the local warehouse, Nexus pre-defined 3 local warehouses, namely releases, snapshots, 3rd party. Tell me what these three pre-built warehouses are for:

Releases:

This is where we build our own projects, usually release versions, for example, we made an FTP server project, and the generated artifacts are ftpserver.war, and we can publish this build to the Nexus's releases local repository. There will be an introduction after the publication of conformance.

Snapshots:

This warehouse is very useful, its purpose is to let us release those non-release version, the non-stable version, such as we develop a project under the trunk, before the official release you may need to temporarily release a version for your companion to use, because your partner is relying on your module development, Then we can release the snapshot version to this warehouse, and your companion can get and use the temporary version with simple commands.

3rd party:

As the name implies, third-party libraries, you may be asked not to have a central warehouse to manage third-party libraries, yes, here is to allow you to add their own third-party libraries, such as some components in the central repository does not exist. For example, if you can't find the JDBC driver for Oracle in the central warehouse, we need to add it to the 3rdparty warehouse ourselves.


2.3 Manually build a library for your own project in Nexus

Build Library, add-->hostedrepository

    


Build Permissions

    


Build roles (Specify permissions)

    


Build user (Specify role)

    


2.4 Maven Warehouse Group

Through the previous introduction can be learned that we can build multiple proxy agent warehouse, hosted local warehouse, if there is no concept of warehouse group, if we need to reference these warehouses is the time to need to add one by one to our setting.xml inside, with the concept of the warehouse group, We just need to do a quote once, and add the warehouses we need to the warehouse group. Such as:

    


Warehouse group default contains local warehouse Releases,snapshots, 3rd party and Agent Warehouse Mavencentral. You can add warehouses to this warehouse group in the configuration page. If you want you can also create a warehouse group, select Add-->repository Group from the Repositories menu


3. Configure the Nexus warehouse in the project

If there is only one project, you can configure it in the project's Pom file:

  


If you have multiple projects that use the Nexus configuration, you can put the above skins containment in the Maven settings file:

  


4. Configure the warehouse image

By default, if the local repository cannot find a dependent artifact, then it needs to go to the nexus when it is needed, and if the Nexus service is turned off, it will be automatically found in the central warehouse.

If we want to overwrite the default address of the central warehouse, the mandatory dependencies will be found in the nexus, even if the nexus is closed it will not be downloaded to the Central factory:

To modify MAVEN settings files:

  


Note that if there is something in the local repository, but not in the nexus, you need to take that thing to the Nexus Warehouse and update the warehouse index:

  

MAVEN Warehouse-nexus Environment construction and brief introduction

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.