Use Nexus to build Maven private server

Recently, IDEA is used to develop projects based on Maven. Some jar packages cannot be found in the local warehouse. It is very slow to download from the central warehouse. First, manage the jar package plug-in through the private server, and put some of your own jar packages on it for your future use. The second is to be able to increase some of your own development efficiency, otherwise it will be impossible.
At the same time, I also learned about Maven's private server from the Internet, which is also very practical in the company. It can solve the problem of intranet access, closed source jar package, repeated download problems, etc. It also increases the motivation to increase knowledge reserves before writing and looking for a job. In short, take it step by step, bae baa. . .

1. Nexus download and install

Premise environment (my own):

  1. Win10 system
  2. JDK1.8
    3.Maven3

Hey, it's a headache to talk about. There is a lot of knowledge about private server construction on the Internet. However, helpless, the latest version I nexus-3.2.0-01-win64.zipdownloaded is different from the version introduced on the Internet. Most of the Internet uses Nexus1.x and Nexus2.x as examples. , and the configuration of Nexus3.x is completely different from the previous two versions, and its directory structure is also different. Here is an example of my version for introduction.

Download address: https://www.sonatype.com/download-oss-sonatype

After downloading, unzip to get two directory structures: nexus-3.2.0-01andsonatype-work

nexus-3.2.0-01It is the installation file directory sonatype-workof Nexus and the working (data) directory of Nexus. Unlike previous versions of Nexus, the startup file of nexus is not run through nexus2.x/bin/nexus.bat, and now the nexus.bat file does not exist at all. , replaced it nexus.exe, so it's really tossing for a long time and I don't know how to play.

2. Nexus configuration

  1. Modify the path of the data storage, the file directory is:\nexus-3.2.0-01\bin\nexus.vmoptions
    nexusVM

  2. Modify the IP, port, access the root directory, and the file directory is: \nexus-3.2.0-01\etc\nexus-default.properties
    nexusDefault
    restart after modification.

There are a few points to pay attention to in this step. First, pay attention to the directory location of each configuration file. Second, you can actually use the default configuration and run it directly to access it. Hehe, why do you need to do it multiple times? It's learning, you can have fun.

3. Nexus operation

Note here that the operation of Nexus 3.x is different from other versions.
First, we have to enter the command line and execute it through the command.
nexusRun

If you think it is troublesome to enter the directory layer by layer, you can directly paste the directory where nexus.exe is located, cd to this directory, or you can first enter the directory where nexus.exe is located, hold down Shift, click the right mouse button, and click here to open the command window , you can go directly to this directory.

The following message appears, which means that nexus is running,
nexusRunMsg

After startup, you can use the browser to access through http://localhost:8088/ (the port I modified myself is 8088, the default is 8081), the interface is as follows:
nexusRunSuccess

You can log in through the upper right Sign in, the default username is admin, and the password is admin123

4. Nexus service installation

This is a bit tricky. It took a long time to install Nexus as a windows service. First of all, it must be installed. Hehe, isn't it nonsense? This step also uses nexus.exethis executable file, so first enter the directory where this file is located. At this step, you may get the following error:
nexusInstallErr

Oh, that's because we didn't use the administrator's identity to enter the command line, and I also made a mistake. The window installation service may use the administrator's identity, so there will be errors. However, running nexus is fine.

Well, let's officially enter the command line as an administrator to execute the installation of the nexus service: the
nexusInstall
above indicates that the installation was successful.
You can look at all the services of our computer, there is the Nexus service.
nexusService

Explain a few commands of Nexus about services:

nexus.exe /install <optional-service-name>                 //nexus服务的安装
nexus.exe /start <optional-service-name>                   //启动nexus服务
nexus.exe /stop <optional-service-name>                    //停止nexus服务
nexus.exe /uninstall <optional-service-name>               //卸载nexus服务

<optional-service-name>I choose the name of the service myself. I choose Nexus. The default official website says it seems to be nexus.

For the two commands start and stop, if the command line is troublesome, you can manually set it in the windows service.

At this point, the installation and download configuration of Nexus is complete. Add a follow if you like. .

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325945012&siteId=291194637