Maven Learning II: Using Nexus to build MAVEN and related configurations

Source: Internet
Author: User
Tags sonatype

In the security and other reasons, some enterprise internal network is not allowed to access the external network, but the project is built within the MAVEN architecture, so that the enterprise in the internal network to build their own MAVEN warehouse services, Furthermore, some of the more distinct enterprise-developed components of large enterprises or in-house modular components will need to use the Maven self-built repository to store the standalone components.

There are a few main steps to using Nexus to build a maven:

1, first of all need to prepare the Java environment and MAVEN environment environment

2. Download the latest version of Nexus Https://www.sonatype.com/download-oss-sonatype to the Nexus official website

  

Select the OSS 2.x ZIP package that supports MAVEN format for download

3, unzip the downloaded zip package to the local directory (Nexus is not installed, in the directory to perform operations can be accessed, so please select the appropriate decompression location), after decompression to see the following directory structure

4, according to their own system and the number of bits into the specified directory (the machine is using the window 64-bit system)

    

The current directory will have the following batch file

Console-nexus.bat #控制台非守护线程方式启动Nexus服务, the console window closes and the thread ends

Install-nexus.bat #安装Nexus作为系统服务, you can set the boot mode, after installation system service name is: Nexus

Start-nexus.bat #启动Nexus服务

Stop-nexus.bat #关闭Nexus服务

Uninstall-nexus.bat #卸载Nexus的Window服务

It is recommended to use the Administrator privilege operation Install-nexus.bat to install Nexus as Window System service

5. Start Nexus system service, access after successful startup: Http://localhost:8081/nexus, you can enter the Nexus console

    

Below is a tutorial on how to configure the use of Nexus

1. Login System

In the system has the foot through the log in the system, the system default user name is Admin/admin123

    

The nexus can be configured after successful login

2. Configure the third-party Jar package Library

2.1. Choose Repositories--3rd party-->artifact upload new jar Package Warehouse

    

2.2, choose Gav Definition, fill in the relevant jar information

    

2.3. Select Upload Jar package, click Add Artifact, then click Upload Artifact, upload the jar package file

2.4. View Upload Results

    

2.5, configure the use of the current MAVEN library

1<project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"2xsi:schemalocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >3<modelVersion>4.0.0</modelVersion>4<groupId>com.luwei.test</groupId>5<artifactId>java</artifactId>6<version>0.0.1</version>7<build>8<plugins>9<plugin>Ten<artifactId>maven-compiler-plugin</artifactId> One<configuration> A<source>1.7</source> -<target>1.7</target> -</configuration> the</plugin> -</plugins> -</build> -<repositories> +<repository> -<id>Nexus</id> +<name>TeamNexusRepository</name> A<url>http://localhost:8081/nexus/content/groups/public</url> at</repository> -</repositories> -<pluginRepositories> -<pluginRepository> -<id>Nexus</id> -<name>TeamNexusRepository</name> in<url>http://localhost:8081/nexus/content/groups/public</url> -</pluginRepository> to</pluginRepositories> +<dependencies> -<dependency> the<groupId>com.lu</groupId> *<artifactId>test</artifactId> $<version>0.00.01</version>Panax Notoginseng</dependency> -</dependencies> the<packaging>pom</packaging> +</project>

After a successful configuration, you can see that the Test.jar package has been automatically introduced in the project.

    

    

Maven Learning II: Using Nexus to build MAVEN and related configurations

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.