How to use Nexus to add jar packages to private servers

How to use Nexus to add jar packages to private servers

Why do we need to build a nexus private server? The reason is very simple. Some companies do not provide external network to project team members, so they cannot use Maven to access the remote warehouse address. Therefore, it is necessary to find a machine with external network permissions in the local area network, build a nexus private server, and then the developers connect to this private server. In this way, they can access Maven's remote warehouse through the computer with the nexus private server.

1. First, make sure that our environment has installed Maven, JDK and other necessary environments

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

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

3. Open the directory nexus-2.4.0-09-bundle\nexus-2.4.0-09\bin\jsw. Under this directory, you will find many system versions of the nexus environment.

My computer is Win7 (64) system, so I chose the Windows-x86-64 version. Of course, you can choose the corresponding version according to your computer system.

Open a version and you will see something like this:

I usually install nexus as a Windows service, so click install-nexus.bat and visit http://localhost:8081/nexus/. After startup, the following page appears. There is a Log in hyperlink in the upper right corner. Click to log in.

The default username is admin and the password is admin123

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

4. Next, let's configure Maven's proxy server (assuming your computer cannot connect to the Internet. If you can, there is no point in going into this, just introducing it)

In the left menu, find the picture below:

Click to view there are many options on the right, find here

Just add your proxy server.

5: Next, it seems that there is no need to configure anything here. Anyway, I didn’t use many functions. Maybe I didn’t learn the technology well and didn’t know how to use it, haha…

By the way, there is another thing you may need to pay attention to, which is 3rd party, Snapshots, and Releases, which are used to save third-party jars (typically Oracle database j driver packages), snapshots within the project team, and releases within the project team.

I am currently just using the 3rd party function to upload the jar package without components in the Maven repository to the server. How to upload a third-party jar to Nexus? As follows: For example, upload the Oracle driver package

Now that Nexus has been installed, how to use the uploaded jar package? It is very simple, provided that you have already created a Maven project. Contains the pom.xml file, add the following to this file:

First go to the server to look at the Maven component of the jar

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

 <repositories>
   <repository>
    <id>nexus</id>
    <name>Team Nexus Repository</name>
    <url>http://localhost:8081/nexus/content/groups/public</url>
   </repository>
  </repositories>
  <pluginRepositories>
   <pluginRepository>
    <id>nexus</id>
    <name>Team Nexus Repository</name>
    <url>http://localhost:8081/nexus/content/groups/public</url>
   </pluginRepository>
  </pluginRepositories>
  <dependencies>
   <dependency>
    <groupId>com.oracle</groupId>
    <artifactId>ojdbc</artifactId>
    <version>10.1.0.2.0</version>
   </dependency>
  </dependencies> 

At this point, the construction of the nexus private server has been completed. When the project team developers develop, they only need to add the following pom.xml information in the project's pom.xml file to obtain the private server jar.

If you add other components, they will be downloaded to the nexus private server first and then downloaded to the local computer. In the future, if a jar package is found to already exist in the private server, it will be downloaded directly from the private server. If not, it will not be downloaded from the Internet. This is the benefit of building a private server. Ha ha........

Therefore, it is necessary to build a Maven private server.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Getting started with Maven: Using Nexus to build a Maven private server and upload and download jar packages
  • Using Docker to build a Nexus private warehouse to implement Maven private service
  • How to upload the jar package to nexus via the web page
  • How to publish Maven project (jar package) to Nexus private server
  • Nexus3x creates a private repository and uploads the jar package using gradle

<<:  MySQL 5.7 mysql command line client usage command details

>>:  React State state and life cycle implementation method

Recommend

React diff algorithm source code analysis

Table of contents Single Node Diff reconcileSingl...

About MySQL innodb_autoinc_lock_mode

The innodb_autoinc_lock_mode parameter controls t...

CSS Viewport Units for Fast Layout

CSS Viewport units have been around for the past ...

MYSQL stored procedures, that is, a summary of common logical knowledge points

Mysql stored procedure 1. Create stored procedure...

CSS to achieve zoom in and out close button (example code)

This effect is most common on our browser page. L...

7 interview questions about JS this, how many can you answer correctly

Preface In JavaScript, this is the function calli...

How to define data examples in Vue

Preface In the development process, defining vari...

How to calculate the frame rate FPS of web animations

Table of contents Standards for smooth animation ...

MySQL 8.0.18 installation and configuration method graphic tutorial under MacOS

This article records the installation of MySQL 8....

CentOS 7.x docker uses overlay2 storage method

Edit /etc/docker/daemon.json and add the followin...

Detailed explanation of simple snow effect example using JS

Table of contents Preface Main implementation cod...

How to use nginx to access local static resources on Linux server

1. Check whether port 80 is occupied. Generally, ...

Installing Windows Server 2008 operating system on a virtual machine

This article introduces the installation of Windo...