Install and use maven3 (III)-build Maven server on the LAN

Source: Internet
Author: User
Tags maven central sonatype

 

4. Build Maven servers for the company's LAN

If Maven is used in the company, a Maven resource warehouse server should be set up locally to maintain the local resource warehouse while acting as a remote Resource Warehouse.

Step 1: Download nexus

Download the latest Nexus from http://nexus.sonatype.org/downloads/

Such as: http://nexus.sonatype.org/downloads/nexus-oss-webapp-1.9.2.4-bundle.zip

As mentioned above, JDK 1.6 has been installed and is dependent on nexus.

Decompress the package to Directory D: \ nexus \ nexus-oss-webapp-1.9.2.4

The Nexus installation directory contains a sibling directory named "sonatype-work ". This directory contains the configuration information of all the resource libraries and nexus.

Step 2: run the server

Go to the following directory:

D: \ nexus \ nexus-oss-webapp-1.9.3.4 \ bin \ JSW

In Windows, select 32-bit or 64-bit

Run nexus. BAT to open

If no error is reported in the black screen, the startup is successful. The default port number is 0.0.0.0: 8081.

After it is started, nexus is running and listens to all IP addresses (0.0.0.0) configured for the current host on port 8081 ). To use nexus, first open a browser and type URL: http: // localhost: 8081/nexus. (You can also use 127.0.0.1 or another configured IP address ). The initial welcome page of nexus is displayed.

Click in the upper-right corner. The log in dialog box is displayed. The default user name is admin and the password is admin123.

Step 3: add an index

In the left pane, select repositories. the user-managed resource list is displayed on the right. Find the preceding three remote resource libraries, set "Download remote indexes" to "true" in the Properties window below, and save the changes.

Apache snapshots

Codehaus snapshosts

Maven Central

Nexus can combine multiple repositories, hosted, or proxy into one group. In this way, Maven only needs to rely on one group to use the content of all repositories contained in this group.

Nexus predefines the "Public repositories" repository group. By default, all predefined release repositories are merged.

Click "Public repositories" in the list and select the "configuration" tab below. In the configuration panel, move the resource library in "avaiable repositories" on the right to "ordered group repository" on the left.

If we adjust nexus for internal LAN development, we should configure a single Nexus group to include release and snapshot. To achieve this goal, add the snapshot resource library to our public group and submit the settings file to Maven ~ Add the following image configuration in/. m2/settings. XML (Maven 3.0.3 is the maven installation directory \ conf \ Settings. XML:

<Settings>
<Mirrors>
<Mirror>
<! -- This sends everything else to/public -->
<ID> nexus </ID>
<Mirrorof> * </mirrorof>
<URL> http: // server IP Address: 8081/nexus/content/groups/Public </URL>
</Mirror>
</Mirrors>
<Profiles>
<Profile>
<ID> nexus </ID>
<! -- Enable snapshots for the built in central repo to direct -->
<! -- All requests to nexus via the mirror -->
<Repositories>
<Repository>
<ID> central </ID>
<URL> http: // central </URL>
<Releases> <enabled> true </enabled> </releases>
<Snapshots> <enabled> true </enabled> </snapshots>
</Repository>
</Repositories>
<Pluginrepositories>
<Pluginrepository>
<ID> central </ID>
<URL> http: // central </URL>
<Releases> <enabled> true </enabled> </releases>
<Snapshots> <enabled> true </enabled> </snapshots>
</Pluginrepository>
</Pluginrepositories>
</Profile>
</Profiles>
<Activeprofiles>
<! -- Make the profile active all the time -->
<Activeprofile> nexus </activeprofile>
</Activeprofiles>
</Settings>

After this configuration, all developers in the team will point to the public repository in nexus. No matter how we adjust the resource library in nexus, developers in the team will not need to change their local configuration. Managers have more control over which resources the team should use.

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.