Use Nexus to build maven under Ubuntu

Source: Internet
Author: User
Tags file copy maven central sonatype sonatype nexus

Use Nexus to build maven under Ubuntu

1. Brief Introduction:

A special remote repository, which is built on a local area network, is to broker remote warehouses and deploy third-party components. When Maven needs to download the widget, it can be downloaded to the local repository if it is available, otherwise the remote repository will be requested to download the widget to the local repository.

We can use dedicated Maven warehouse management software, such as the Apache Archiva,artifactory,sonatype Nexus. Here we use the Sonatype Nexus.

2. Install Nexus

Nexus Pro is charged, here we download the open source Nexus OSS.

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

Put the downloaded compressed package on the target server for decompression

After decompression in the directory will get nexus-2.14.3-02 and sonatype-work these two folders, where nexus-2.14.3-02 is the Nexus system files, Sonatype-work is the working directory of the MAVEN, we upload and download the jar are in here;

Next, we're going to change the Nexus's run port to avoid port collisions at boot time, enter the Conf directory inside the NEXUS-2.14.3-02, modify nexus.properties this file

Because Maven stores the jar package, it needs to be compiled at upload, so the path of the JDK needs to be configured

Go to Conf in jsw in bin directory, modify wrapper.conf this file

After configuring the path to the JDK, you can start the Nexus service using the Nexus script in the bin directory (actually using the Nexus.bat operation Nexus under the sibling directory)

The execution will have the corresponding prompt;

Nexus runtime, the log will be printed in the logs directory, there is a problem is not to forget to look at the log;

After the service is turned on, find a browser to access the Http://192.168.100.52:8081/nexus IP input to your own,

3, simple to use:

Login nexus, the default user name is: admin, password is: admin123

Explain what these warehouses are all about:

3rd Parth: Third-party library, mainly store some third-party jar packages;

Apached Snapshots:apache's development version of the Jar repository;

Central: Centralized warehouse, where the jar package is stored in the central warehouse;

Central M1 Shadow: This is a virtual warehouse in the centralized warehouse;

Releases: This is the warehouse where we are uploading the secure version of the jar package;

Snapshots: This is the jar package that holds the development version;

Public repositories: This is a warehouse group, you can add the above warehouse to this warehouse group;

Next, it is necessary to download the index, no index, the network will not be able to go to the extranet of the MAVEN central repository to download the jar package, need to be with the new apached snapshots these two libraries

Download on the page, I think you see this, there is an option to update the index, in general, the index of the central warehouse is updated once a week, we can update it once a month, the first download time is longer, compared to the current index reached more than 2 G, can be in scheduler On the Tasks page, look at the progress of the update task:

Of course, you can also update the index in a manual way

Download the latest version of the index file to the central repository

http://repo.maven.apache.org/maven2/.index/

Pull to last download nexus-maven-repository-index.gz

Nexus-maven-repository-index.properties of these two files

If nexus-maven-repository-index.properties cannot download, it can only click to copy;

Out of these two files, you also need a indexer-cli-5.1.1.jar to decompress

Place the three files in the same folder and perform

Java-jar indexer-cli-5.1.1.jar-u nexus-maven-repository-index.gz-d Indexer

This command began to decompress, may be a bit long, estimated to be more than 20 minutes;

After the decompression is complete, the indexer (the folder will be created automatically when extracting) so the file copy to the Sonatype-work/nexus/indexer/central-ctx directory, restart the Nexus

At this point, the Nexus configuration maven is complete;

Attached: Nexus Boot self-starter

1. Add executable script in/ETX/INIT.D Nexus,nexus content as follows:

Where the contents of the red box must be added, this is the system to identify the start-up basis

Because Nexus does not support root boot

So, switch to normal user at startup to start

2. Configure the boot level:

1,/ETX/INIT.D in the new executable script Nexus will not be added to Service Server Manager, you need to execute the command: UPDATE-RC.D Nexus Dafaults to add to Service Server Manager;

2. Configure the Nexus's boot level:

Note: When you first use the UPDATE-RC.D nexus Enable, The soft connection generated in the RC2.D is S20nexus this is a bit far from the s99nexus we want, because we need the nexus to start, and the minimum (0-99) is the first boot based on the rule of the start level, so we will change the soft connection to S99nexus;

So create a soft connection manually:

This will enable the Nexus to start automatically as soon as the machine is restarted.

Use Nexus to build maven under Ubuntu

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.