Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.
The nexus installation
Some people online said that the nexus download website is very slow, if there is no exception, will definitely over the wall; If you can find a compile-free installation binaries, everyone is happy; https://www.sonatype.com/download-nexus-repo-oss Nexus Repository Manager warehouse management has two versions, pro version < charge > and oss version < > free version, generally choose the oss.Copy the code
The nexus is introduced
Introduction is nothing more than to praise its good, understand its implementation principle, some people use, that it is worth it, with everyone say good, then it is worth it; From its benefits to UI display, its function demonstration to simple operation, perfect integration with IDEA and Eclipse use;Copy the code
- Why?
Much of this has to do with advantages:Copy the code
-
- Saves extranet bandwidth.
-
- Speed up Maven builds.
-
- Deploy third-party artifacts.
-
- Improved stability and enhanced control.
-
- Reduce the load of the central warehouse.
-
- Control and audit
-
- Set up local internal common warehouse
The nexus configuration
- Binary decompression
- Edit the Nexus service port
[root@localhost /]# vim .. # / nexus/etc/nexus. The properties editor application port - the port = 8081 application - host = 0.0.0.0Copy the code
- Modifying a Startup User
[root@localhost /]# vim .. RUN_AS_USER=root APP_NAME="nexus" APP_LONG_NAME="nexus oos"Copy the code
- Start the nexus
[root@localhost /]#./bin/nexus start #Copy the code
- Nexus Warehouse Type
-
- Hosted locally
-
- The proxy agent
-
- Group warehouse group
- Maven-central central repository: generally configured remote Maven directory, belongs to the proxy type
-
- Some will be configured: Maven-Aliyun is essentially configuring different central repositories so that other repositories don’t find jar packages
-
- Maven repositories of the proxy type can be configured in multiple ways
- Maven-releases: Private library release JAR, of the Hosted type
- Maven-snapshots: Specifies the private library snapshot (debug version) JAR. It is of the Hosted type
- Maven-third-party: As its name implies, a third-party JAR package of hosted type
- Maven-public: specifies the repository group. In fact, the three above items are unified and belong to the group type
-
- You can add all jars from remote central repositories and local deployments to the maven-public group type and open them to the public
Local repository managed by Nexus
- Releases: Releases builds in your own project deploy
- Snapshots: Snapshots and temporary versions
- Third-party: third-party JAR
# Locally deploy POM configuration <distributionManagement> <repository> < ID > Nexus -releases</ ID > <name> Maven-releases </name> The < url > http://192.168.2.18:8081/repository/maven-releases/ < / url > < / repository > < snapshotRepository > < id > nexus - snapshots < / id > < name > maven - snapshots < / name > < url > http://192.168.2.18:8081/repository/maven-snapshots/ < / a > url </snapshotRepository> </distributionManagement>Copy the code
Nexus central warehouse address
- Repo. Spring. IO/plugins – rel…
- Maven.aliyun.com/nexus/conte…
Remote Maven central repository, from near to far, select domestic or normal access address, avoid local download failure.Copy the code
Nexus manages maven repositories
- Start nexus service, access the server + set up the listening port, access the Web end
- Go to Repository–>Repositories, Create Repository to select the Repository type
- By default, you only need to enter a name, and other parameters are automatically filled in
maven
- Configure environment variables: vim /etc/profile
MAVEN_HOME=/usr/local/maven
PATH=$PATH:$MAVEN_HOME/bin;
export MAVEN_HOME PATH
Copy the code
- Source /etc/profile takes effect immediately