Create a MAVEN private warehouse using Nexus

Source: Internet
Author: User
Tags maven central sonatype

1. Why do I need a maven private warehouse?

Downloading the required jar packages from the MAVEN central repository requires support from the extranet. If the company can not sisu the network, you can not download the required jar from the central warehouse, the company's slow speed will also affect the construction of the project. Users can create a private maven repository with a nexus.

2. Download and deploy Nexus

First download Nexus, is http:///www.sonatype.org/nexus/go on this page can download the latest version of the Nexus, can download the zip package can also download the war package. It is important to note that the two packages are deployed differently.

How ZIP packages are deployed

A. Unzip the ZIP package to the specified path such as "D:\workbase" B. Run cmd and go to "D:\workbase\nexus-2.6.0-05\ Bin" Path C. Then run Nexus.bat Install NEXUSD. Then run the Nexus.bat Start command to start the Nexus

Other commands have nexus.bat stop stop nexus.bat Restart restart Nexus.bat Uninstall Uninstall

How the war package is deployed

Put the war packet directly under Tomcat's WebApp and launch Tomcat.

Enter http://localhost:8088/nexus/in the browser address bar to enter the Nexus home page. There is a management nexus to log in as an administrator, click Login in the top right corner of the homepage to enter the default login name, password admin/admin123 to log in.

Note the JDK version matches the

The latest version of the official download is the 2.6.0-05,jdk1.6 version of the Nexus with the error cannot start, the error is as follows:

Launching a JVM ...
JVM 5 | Java.lang.unsupportedclassversionerror:org/sonatype/nexus/bootstrap/jsw/jswlauncher:unsupported Major.minor Version 51.0

Download the previous version of the Nexus on the official website as 2.4.0 replaced.

After logging into the system, click on the left menu bar under views/repositories repositories Select Central Warehouse click the configuration below to set the download Remote indexes property to True save.

Click Repositories to see a list of warehouses, including the following:

Public Repositories Warehouse Group
3rd Part Three-party library, can upload jar package to this warehouse
Central MAVEN Center Warehouse
Releases builds that are published in their own projects
Development of a project under the snapshots trunk

Then right-click on the central warehouse and repair index to download the indexed file of the center warehouse, wait a few minutes click on Browse index below to see the downloaded index file.

To add the central repository to public repositories, click Public repositories on the Configuration tab to move central to the left.

Finally, in your own application, the central warehouse is configured as a private warehouse address, modify the local maven configuration file, C:\Documents and Settings\ user name \.m2\setting.xml

In the Mirrors Add mirror node address to the established private warehouse address, the Mirrorof property value is set to Central in order to overwrite the address specified in the Super Pom, as follows

Maven Warehouse

The Maven repository is the place where MAVEN packages are centrally stored. These warehouses can be placed locally or on a remote server. It can be a private warehouse, or it can be public.

    • There is a local
Maven {URL ' file:///Users/my-user-name/Documents/Android/repo/'}
    • The presence of an intranet server
Maven {URL ' http://192.168.99.100:8081/content/repositories/releases/'}
    • exists for a remote server.
Maven {    URL ' https://raw.githubusercontent.com/liaohuqiu/umeng-libs/master/repository '}

Appendix: MAVEN Warehouse Address ingest

A public warehouse
http://repo1.maven.org/maven2/
http://repository.jboss.com/maven2/
http://repository.sonatype.org/content/groups/public/
http://mirrors.ibiblio.org/pub/mirrors/maven2/org/acegisecurity/

A private warehouse
http://repository.codehaus.org/
http://snapshots.repository.codehaus.org/
Http://people.apache.org/repo/m2-snapshot-repository
http://people.apache.org/repo/m2-incubating-repository/

Create a MAVEN private warehouse using Nexus

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.