The use of Maven to build a nexus in MyEclipse

Source: Internet
Author: User
Tags sonatype log4j

Start to note: The content below the individual images are pasted from several sites, the time is too long forgotten to indicate the source, the original author saw can remind me, I marked, sorry! Most of them are summarized by themselves, some of the descriptions are relatively thin, only to discuss the individual can understand the part. If you do not know if MAVEN is configured in MyEclipse, then see my previous post: "Maven configuration in myeclipse8.6".

1. Introduction

This is primarily the use of Maven and the Nexus. The Nexus is understood to create a central repository-like processor on the local LAN, and we begin to download the data to a central server and then access the central server directly in the local MAVEN project, which

Saving the network broadband will also accelerate the project development progress, the figure is shown below:

650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M01/7F/E1/wKioL1cwxKHghw9BAACGu-_9HUo721.jpg "style=" float: none; "title=" 1.jpg "alt=" Wkiol1cwxkhghw9baacgu-_9huo721.jpg "/>

2. Download to local and install

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

650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M00/7F/E1/wKioL1cwxKHi9VCqAADobN0uRYk410.jpg "style=" float: none; "title=" 2.jpg "alt=" Wkiol1cwxkhi9vcqaadobn0uryk410.jpg "/>

Click Nuexs OSS (ZIP), will let enter the mailbox, ignore can, if not automatically download, then copy URL link to thunder can download.

For example: Https://sonatype-download.global.ssl.fastly.net/nexus/oss/nexus-latest-bundle.zip

Unzip the Nexus-latest-bundle.zip and enter the E:\nexus\nexus-latest-bundle-zip\nexus-2.11.4-01\bin\jsw\windows-x86-64

Double-click the Console-nexus.bat installation, will pop up the doc box, wait for the installation, the middle do not turn off the Doc box.

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/7F/E3/wKiom1cww8ThSE5dAAAN69kMTXQ371.png "style=" float: none; "title=" 3.png "alt=" Wkiom1cww8thse5daaan69kmtxq371.png "/>

3. Operation Nexus

The viewer enters http://127.0.0.1:8081/nexus/and appears as shown to represent that the Nexus has started successfully.

8081 is the default port number, to modify the port number can go into the nexus-2.1.2-bundle\nexus-2.1.2\conf\ open nexus.properties file, modify the Application-port property value is available.

Default user name and password: admin/admin123, after login see as shown: 650) this.width=650; "Src=" http://s5.51cto.com/wyfs02/M02/7F/E3/ Wkiom1cww8swgt6maabmxeark2a216.png "style=" Float:none; "title=" 4.png "alt=" wkiom1cww8swgt6maabmxeark2a216.png "/ >

The following is an explanation of a few columns in the above diagram:

-------------------------------------------------------------------------------------

TYPE:

Hosted type of warehouse, internal project release warehouse

Release repository for the release module in the releases internal module

Snapshots Release the warehouse of the internal snapshot module

Proxy type of warehouse, from the remote central warehouse to find the Data Warehouse

A warehouse of group type that is used by the warehouse to facilitate the setup of our developers.

-------------------------------------------------------------------------------------

REPOSITORY:

Publicrepositories: Warehouse Group

3rd party: A component repository that cannot be obtained from a public warehouse (a personal understanding operation: A jar package that is not in the Maven repository and needs to be manually uploaded to the repository)

Apache Snapshots: A component repository with proxy Apachemaven Warehouse snapshot version

Central: The warehouse used to proxy the release builds in the MAVEN repository (Personal understanding: Maven Warehouse)

Central M1 Shadow: A component-mirrored warehouse used to provide a release version of the M1 format in a centralized warehouse

Codehaus Snapshots: The warehouse used to proxy the snapshot version artifacts of the Codehausmaven warehouse

Releases: the host type Warehouse used to deploy internal release build artifacts

Snapshots: The host type Warehouse used to deploy the snapshot version artifacts within the administration

-------------------------------------------------------------------------------------

Understand:

The general type of warehouse used is hosted, proxy. Hosted represents the host repository, which is used to publish components that are not allowed by third parties, such as Oracle drivers, such as commercial software jar packages. Proxy represents the remote warehouse, the most typical is the MAVEN official Central warehouse, JBoss warehouse and so on. If the built MAVEN project local warehouse does not depend on the package, then will go to this proxy site to download, then if the proxy site also does not have this dependent package, go back to Remote central repository download dependency, these central warehouse is proxy. The proxy site is downloaded successfully and then downloaded to this machine. I think, in fact, maven this default warehouse is usually enough to use the majority of projects. Special case in the configuration of a new warehouse, specify the URL can, generally familiar with the extjs of the person to operate the nexus is not a problem, the word is not difficult, do not understand the basic word of the same look. It would be better if the Sonatype company did an international deal on it.

The concept of the warehouse group in Nexus is not maven, in Maven's view, whether you are hosted or proxy, or group, for me is the same, I just according to Groupid,artifactid,version and other information to you to the component. To facilitate MAVEN configuration, the nexus can combine multiple warehouses, hosted or proxies into a group so that Maven relies on a group to use all the contents of the warehouse that the group contains.

-------------------------------------------------------------------------------------

4. Nexus Configuration (MAVEN configuration reference maven-use section. )

4, 1 using the existing Nexus index configuration

The required indexes are public repositories,3rd party and central. If the new Nexus is inconsistent with the attributes in the diagram below, it needs to be adjusted.

--------------------------------------------------------------------------------------------

Public repositories section, you need to pay attention to the lower left order:

650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M02/7F/E1/wKioL1cwxKLAQniKAAEUmdp3R-E719.jpg "style=" float: none; "title=" 5.jpg "alt=" Wkiol1cwxklaqnikaaeumdp3r-e719.jpg "/>

--------------------------------------------------------------------------------------------

3rd party section:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/7F/E1/wKioL1cwxKLCnI-dAABQBWziCQ4872.png "style=" float: none; "title=" 6.png "alt=" Wkiol1cwxklcni-daabqbwzicq4872.png "/>

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7F/E3/wKiom1cww8WggHyLAAAvU-5A_nc853.png "style=" float: none; "title=" 7.png "alt=" Wkiom1cww8wgghylaaavu-5a_nc853.png "/>

Join a third-party jar package that does not exist in the MAVEN library locally, such as The Oracle JAR package:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7F/E3/wKiom1cww8ay86UPAACviPePs9M845.png "style=" float: none; "title=" 8.png "alt=" Wkiom1cww8ay86upaacvipeps9m845.png "/>

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7F/E1/wKioL1cwxKPA74baAAA1s4qOE2Q467.png "style=" float: none; "title=" 9.png "alt=" Wkiol1cwxkpa74baaaa1s4qoe2q467.png "/>

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7F/E3/wKiom1cww8bgfoMXAAAaMNDiuPM079.png "style=" float: none; "title=" 10.png "alt=" Wkiom1cww8bgfomxaaaamndiupm079.png "/>

650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M00/7F/E1/wKioL1cwxKOzwoSzAADNFLUROro227.jpg "style=" float: none; "title=" 11.jpg "alt=" Wkiol1cwxkozwoszaadnfluroro227.jpg "/>

--------------------------------------------------------------------------------------------

Central section:

The new NEUXS environment is just an empty warehouse, need to manually and Remote Central Library synchronization, nexus by default is to turn off remote index download, the most important thing is to open the remote index download. Change download remote indexes to true.

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7F/E1/wKioL1cwxKSA_P-vAABHQWiB_iU285.png "style=" float: none; "title=" 12.png "alt=" Wkiol1cwxksa_p-vaabhqwib_iu285.png "/>

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/7F/E3/wKiom1cww8fR1v01AAA35U2kMTQ054.png "style=" float: none; "title=" 13.png "alt=" Wkiom1cww8fr1v01aaa35u2kmtq054.png "/>

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/7F/E1/wKioL1cwxKSiIyDHAAA2HqslfgU121.png "style=" float: none; "title=" 14.png "alt=" Wkiol1cwxksiiydhaaa2hqslfgu121.png "/>

After saving the background will run a task, click on the menu bar administration-Scheduled Tasks option can see a task in running.

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/7F/E3/wKiom1cww8ezfdhoAAAcWYZEl6Q018.png "style=" float: none; "title=" 15.png "alt=" Wkiom1cww8ezfdhoaaacwyzel6q018.png "/>

Once the download is complete, the MAVEN index is ready to use, and you can find the relevant information by entering the item you want to search for in the search field.

650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M01/7F/E1/wKioL1cwxKXxjscEAAEKdvB8Ea8680.jpg "style=" float: none; "title=" 16.jpg "alt=" Wkiol1cwxkxxjsceaaekdvb8ea8680.jpg "/>

Or in the main page search can jump to the above page.

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7F/E3/wKiom1cww8iBe6PlAACAlw4A5fE079.png "style=" float: none; "title=" 17.png "alt=" Wkiom1cww8ibe6plaacalw4a5fe079.png "/>

After clicking the Save button, right-click on each repository, and do repair index operation, so that the remote index file will be downloaded.

650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M02/7F/E3/wKiom1cww8jTaWMtAADYaG08PQE684.jpg "style=" float: none; "title=" 18.jpg "alt=" Wkiom1cww8jtawmtaadyag08pqe684.jpg "/>


Open the Browse index button for different indexes, such as central, and you will see a list of the corresponding jar packages:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7F/E1/wKioL1cwxKWRR0lyAAAyYK6TFgk335.png "style=" float: none; "title=" 19.png "alt=" Wkiol1cwxkwrr0lyaaayyk6tfgk335.png "/>

--------------------------------------------------------------------------------------------

MAVEN Engineering configuration in MyEclipse Pom.xml, general content:

<project xmlns= "http://maven.apache.org/POM/4.0.0"  xmlns:xsi= "http://www.w3.org/2001/ Xmlschema-instance " xsi:schemalocation=" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ Maven-v4_0_0.xsd ">  <modelVersion>4.0.0</modelVersion>  <groupId> Maventest01</groupid>  <artifactid>maventest01</artifactid>  <version >0.0.1-SNAPSHOT</version>  <packaging>war</packaging>  <!--  Version Properties  --><properties><!-- lib version setting --><spring.version> 4.1.6.release</spring.version><mybatis.version>3.2.8</mybatis.version>< mybatis-spring.version>1.2.2</mybatis-spring.version><mysql.driver.version>5.1.35</ mysql.driver.version><druid.version>1.0.13</druid.version><!-- project util  Lib version setting --><util.version>0.2.2-SNAPSHOT</util.version><!-- util lib version setting -->< log4j.version>1.2.17</log4j.version><slf4j.version>1.7.7</slf4j.version>< Jackson.version>2.5.1</jackson.version><commons-lang3.version>3.3.2</commons-lang3.version ><commons-beanutils.version>1.9.2</commons-beanutils.version>

-------------------------------------------------------------------------------------------

Attention:

One of the url:<url>http://127.0.0.1:8081/nexus/content/groups/public/</url>

The public inside is: Repository's public repositories group Id:public

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7F/E1/wKioL1cwxKbilJLVAAAWiwBKf_w653.png "style=" float: none; "title=" 20.png "alt=" Wkiol1cwxkbiljlvaaawiwbkf_w653.png "/>

When the MAVEN project compiles successfully, the Nexus Library's local jar package path is: E:\nexus\nexus-latest-bundle-zip\sonatype-work\nexus\storage\central

The path to the MAVEN project downloaded to the local maven library is: E:\maven\repository

Don't confuse the two.

--------------------------------------------------------------------------------------------

4, 2 Create a new local Nexus index, with roughly the same content as the existing index.

New, Group,hosted,proxy, respectively

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7F/E3/wKiom1cww8nQW8CGAAAlLx5BkdU754.png "style=" float: none; "title=" 21.png "alt=" Wkiom1cww8nqw8cgaaallx5bkdu754.png "/>

Hosted host warehouse section, according to 3rd party operation:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7F/E1/wKioL1cwxymxATcHAABGW7blI2E862.png "title=" 1-1. PNG "alt=" Wkiol1cwxymxatchaabgw7bli2e862.png "/>

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7F/E3/wKiom1cww8mTvDTLAAAnk2LjoOk402.png "style=" float: none; "title=" 22.png "alt=" Wkiom1cww8mtvdtlaaank2ljook402.png "/>

Proxy Agent Warehouse section, according to the central section operation:

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7F/E1/wKioL1cwxKagmFW0AAAv9IH47IE727.png "style=" float: none; "title=" 23.png "alt=" Wkiol1cwxkagmfw0aaav9ih47ie727.png "/>

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/7F/E1/wKioL1cwxKfAbIPpAAAyzH-UPeA465.png "style=" float: none; "title=" 24.png "alt=" Wkiol1cwxkfabippaaayzh-upea465.png "/>

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/7F/E3/wKiom1cww8qSeZK4AAAQhamQpII623.png "style=" float: none; "title=" 25.png "alt=" Wkiom1cww8qsezk4aaaqhamqpii623.png "/>

Group warehouse Groups section, according to the public repositories operation, pay attention to the lower left corner of the Add order:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7F/E3/wKiom1cww8rwpX2kAABOs6SZe0Q899.png "style=" float: none; "title=" 26.png "alt=" Wkiom1cww8rwpx2kaabos6sze0q899.png "/>

--------------------------------------------------------------------------------------------

Note that you should not forget to save and repair the index operation after you finish the new section.

Modify the URL in Pom.xml in the MAVEN project to:<url>http://127.0.0.1:8081/nexus/content/groups/public-snapshots/</url>

When the Pom.xml transformation is complete, note that the MAVEN project will first fetch the corresponding jar package from the local Nexus Repository, and if the local repository does not, go to the extranet Maven repository to fetch the jar.

--------------------------------------------------------------------------------------------

The corresponding jar package is then queried in the corresponding group,hosted and proxies:

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/7F/E1/wKioL1cwxKejQW4_AAAp6lsLxN4833.png "style=" float: none; "title=" 27.png "alt=" Wkiol1cwxkejqw4_aaap6lslxn4833.png "/>

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/7F/E3/wKiom1cww8qSsLzuAAAef8owwvo897.png "style=" float: none; "title=" 28.png "alt=" Wkiom1cww8qsslzuaaaef8owwvo897.png "/>

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/7F/E1/wKioL1cwxKeC8LU_AAAh7FmA_kI957.png "style=" float: none; "title=" 29.png "alt=" Wkiol1cwxkec8lu_aaah7fma_ki957.png "/>

Note: You can see that the group includes hosted and proxy, which only corresponds to all the jar packages in the MAVEN project corresponding to Pom.xml. While My3rdparty is a third-party, the mycentral includes all the jar packages in the MAVEN library.

This article is from the "You can choose Extraordinary" blog, please be sure to keep this source http://ylcodes01.blog.51cto.com/5607366/1771650

The use of Maven to build a nexus in MyEclipse

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.