Maven Learning (iv) using Nexus to build a maven

Source: Internet
Author: User

Why to set up a nexus, the reason is very simple, some companies do not provide the network to the project team, so you can not use MAVEN to access the remote warehouse address, it is necessary to find a network in the LAN access to a network of machines, to build a nexus, and then developers to connect to this server, This will allow you to access MAVEN's remote repository through this PC with a nexus.

1. First determine our environment to install the necessary environment such as MAVEN,JDK

2. After these are ready, go to download the latest version of Nexus:http://www.sonatype.org/nexus/go

I installed the Nexus-2.2-01-bundle locally, the latest version is Nexus-2.4.0-09-bundle

3. Open Directory NEXUS-2.4.0-09-BUNDLE\NEXUS-2.4.0-09\BIN\JSW This directory you will find there are many system versions of the Nexus environment

My Computer is Win7 (64) for the system, so I chose windows-x86-64 this version, of course, according to the personal computer system to choose the corresponding version

To open a version you will see the following:

I usually install the Nexus as a Windows service, so click install-nexus.bat This, access http://localhost:8081/nexus/after the start of the following page, in the upper right corner there is a log in hyperlink, Click Sign in

The default user name is the admin password is admin123

After logging in, you can modify your login information on the left:

4. Next, we configure the MAVEN proxy server (provided that your computer can not connect to the network, if it is possible to sisu the net, there is no meaning, just introduce)

Found on the left menu

Click to view right there are many options to find here

Add your proxy server to it.

5: Next, it seems that there is no need to configure the, anyway, I do not use a lot of features, may be the technical study is not good, will not use, hehe ....

By the way, there is one more thing to note here is the 3rd party, the snapshots, the releases three, respectively, to hold the third side jar (the typical Oracle database's J driver), the snapshot within the project group, the release version within the project group.

I'm just using this third-party feature of 3rd parties to upload a jar package with no artifacts from the MAVEN repository to the server. How do I upload a third-party jar to a nexus? As follows: Upload an Oracle driver package for example

So now that the Nexus has been installed, how to use the uploaded jar, very simple, if you have built a MAVEN project. Contains pom.xml this file, add the following to this file:

Go to the server first to see the jar's Maven widget

Then add the following local warehouse address in Pom.xml:

1<Repositories>2<Repository>3<Id>nexus</Id>4<Name>team Nexus Repository</Name>5<Url>http://localhost:8081/nexus/content/groups/public</Url>6</Repository>7</Repositories>8<Pluginrepositories>9<Pluginrepository>10<Id>nexus</Id>11<Name>team Nexus Repository</Name>12<Url>http://localhost:8081/nexus/content/groups/public</Url>13</Pluginrepository>14</Pluginrepositories>15<Dependencies>16<Dependency>17<GroupId>com.oracle</GroupId>18 <artifactid>ojdbc</ artifactid>19 Span style= "color: #0000ff;" ><version>10.1.0.2.0 </version>< Span style= "color: #008080;" >20 </dependency21 </>          

This completes the construction of the nexus, and when the project team developer develops, the jar can be obtained by adding the following pom.xml information in the project's Pom.xml file.

If additional artifacts are added, they will be downloaded to the Nexus before they are downloaded locally. Later, if a jar package is found, it will be downloaded directly from the Web, if it is not downloaded on the network. This is the benefit of setting up a. Ha ha........

So it's necessary to build a maven.

Maven Learning (iv) using Nexus to build a maven

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.