Locally built Springmvc+redis integration with MAVEN

Source: Internet
Author: User
Tags apache tomcat maven central

---restore content starts---

First, the local need to set up a small, simple talk about the steps of the building

1. Why Use Nexus

If there is no one, all of the artifacts we need are downloaded locally through MAVEN's central repository and third-party maven repositories, and everyone on the team repeats the download from the Maven repository, which undoubtedly increases the load on the warehouse and wastes the external bandwidth, if the network speed is slow, It can also affect the process of the project. In many cases, the development of the project is in the intranet, do not connect to the MAVEN warehouse how to do? How can public components be developed for use by other projects? This time we have to build our own Maven for our team, which saves network bandwidth and accelerates the process of building the project, but the prerequisite is that you have all the artifacts you need for your project.

2.Nexus Downloads

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

3.Nexus Boot

I downloaded the zip package, after decompression into the \nexus-2.1.2-bundle\nexus-2.1.2\bin\jsw\, according to the operating system Type selection folder, I chose the windows-x86-64 folder, enter the following can see the bat file as shown below.

4. Go to Nexus Management page

Http://localhost:8081/nexus/index.html

Default Password admin admin123

Nexus Warehouse

The Nexus warehouse type is divided into the following four types:

Group: Warehouse Groups

Hosted: Host

Proxy: Agent

Virtual: Dummy

You can see one of the following warehouse groups and multiple warehouses when you first log in to the Nexus.

Public repositories: Warehouse Group

3rd party: A component warehouse that cannot be obtained from a public warehouse

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

Central: The repository used to proxy the release builds in the MAVEN repository

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

5. Configure Nexus

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. Login Nexus System, the default user name password is admin/admin123.

Click repositories below the left administration menu to find the three warehouses in the right warehouse list Apache Snapshots,codehaus snapshots and Maven Central, Then the download Remote indexes is changed to true without the configuration of the warehouse. Such as

Then right-click on the three warehouses of Apache Snapshots,codehaus snapshots and Maven Central and select Repari Index, so the nexus will download the remote index file.

When this is set up, the Nexus automatically downloads the index file from the Remote central repository, and in order to verify that the index file is automatically downloaded, you can switch to the browse index

In the left menu bar there is a artifact search, in the input box to enter the name of the widget you want to search, such as: Maven, then the query results are as follows:

6. Building a hosting repository

New company's internal warehouse, step repositories–> add–> Hosted Repository, fill in the bottom half of the page in the input box Repository ID and Repository name, such as filling in

XB and XB Repostiory, in addition deployment policy is set to allow redeploy, click Save to create the complete.

Here I click Add Host type of warehouse, below the warehouse list there will be a new warehouse configuration, as follows:

7. Create a Nexus Warehouse group

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.

By default, a group named "Public Repositories" is included in the neuxs-1.9.2.3, which can be adjusted for his protected warehouse, adding the company's internal warehouse, XB Repostiory, which was just established. This makes it unnecessary to explicitly specify the address of the internal repository in Maven. At the same time, create a group ID of public-snapshots, groups name is public snapshots repositories, the Apache snapshots, Codehaus snapshots, Snapshots and ZfY repostiory to join them.

Here Neuxs's installation configuration is complete, here's how to use your own in Maven

Set up, then create the MAVEN project, the eclipse I'm using here

GroupID and Artifactid are collectively referred to as "coordinates" in order to ensure the uniqueness of the project, if you want to get your project to the MAVEN local repository, you want to find your project must be based on these two ID to find.
GroupID generally divided into several paragraphs, here I only say two paragraphs, the first paragraph is the domain, the second paragraph is the company name. Domain is also divided into org, COM, CN and so many, including Org is not a profit organization, COM for business organizations. Example of an Apache Tomcat project: The project's GroupID is Org.apache, its domain is org (because Tomcat is a nonprofit project), and the company name is Apache,artigactid Tomcat.
For example, I create a project, I will generally set the GroupID to CN.XB,CN for China, XB is my personal initials, Artifactid is set to Testproj, indicating that your project name is testproj, according to this setting, your package structure is preferably cn.xb.testProj, if there is a s Tudentpeng, its full path is Cn.xb.testProj.StudentPeng.

At this point the project is also wrong, by prompting the message that the HttpServlet class can not be found, by importing Tomcat to the working directory or through Maven to add the HttpServlet class Servlet-api.jar

---restore content ends---

Build Springmvc+redis integration with Maven locally

Related Article

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.