Limited knowledge, currently only for basic functions, continuous Update
First, download the corresponding version (in this case version: NEXUS-3.7.1-02)
Https://www.sonatype.com/download-oss-sonatype
Second, start the service, enter the corresponding installation directory, hold down SHIFT right button, open the cmd command line, execute Nexus.exe/run
My NEXUS directory: Nexus_home\nexus-3.7.1-02-win64\nexus-3.7.1-02\bin
The final boot success prompt is as follows, can access http://192.168.1.168:8081/login, account admin password admin123
Three, the page introduction 1. Warehouse Page
Click Navigation Browse, this is all the warehouses that have been configured
Name:
maven-central: Maven Central Library, pull the jar package from https://repo1.maven.org/maven2/by default, this remote address can be changed, you can also create another
maven-releases: Private repository release jar
maven-snapshots: Private Library Debug Version jar
maven-public: Warehouse grouping, combining the above three warehouses to provide services to the outside
Type:
Proxy: Agent remote repository
hosted: Local jar Package
Group: Warehouse Groups
2. Search function
Easy to find jar packages quickly, select Search in the navigation, you can choose several types of search methods, such as by name, by version, by warehouse Group, etc., this function is fuzzy Lookup
3. Create a modify warehouse & Warehouse Group
Click the gear icon above to open the Configuration Management page, where the Repository column for the warehouse management, the following only for the Blob Stores, repositories description
Blob Stores:The storage path of the jar package, which is stored by default under Nexus_home/sonatype-work\nexus3\blobs\default, creates multiple
Repositories:
Create Agent Warehouse Proxy
① Choosing Create repository Creating a warehouse
② Select warehouse Type maven2 (proxy)
③ Setting the warehouse name
④ Set the warehouse version, the Agent warehouse is typically set to releases
⑤ Configuration Download storage path, default is Blob Stores
⑥ Configuring the Agent warehouse address, I'm using Ali's
Save creation after completion to complete the creation of the agent warehouse
Create a local warehouse ( a third party, a jar that is not in the agent repository is put here ) hosted, repeat the above process, different places are as follows
② Select Warehouse Type maven2 (hosted)
④ Set the warehouse version, releases or snapshots, the difference is as follows:
There is a jar package of its own package, the jar is in the development version, the recent update, version 1.0, using the Snapshots warehouse, after the future Jar package update, only need to pass the new package to the warehouse,
The project will automatically download updates to this package, no need to modify the version number, with releases this warehouse, each change jar package must upgrade version number, the corresponding project Pom file to be modified, otherwise the new jar package will not be downloaded
⑥ This step instead, the purpose is to upload the deployment jar
Create warehouse groups Group, Repeat the above process, different places are as follows
② Select Warehouse Type MAVEN2 (group)
④ set which warehouses are grouped into a group
So far, the Nexus warehouse is partially operational.
Iv. use of warehouses 1. Configuring Maven Settings.xml
URL self-Modification in configuration
<Mirrors> <Mirror> <ID>Content</ID> <mirrorof>*</mirrorof> <name>Maven-public</name> <URL>http://192.168.1.168:8081/repository/maven-public/</URL> </Mirror> </Mirrors>
<Servers> <Server> <ID>Nexus</ID> <!--This id is used to upload the jar -- <username>Admin</username> <Password>Admin123</Password> </Server> </Servers>
2. In the project Pom.xml, configure the following, purpose: Snapshots mode, update policy settings, non-snapshots mode is not configured
<distributionmanagement> <snapshotrepository> <ID>Nexus</ID> <URL>http://192.168.1.168:8081/repository/maven-public/</URL> </snapshotrepository> <Repository> <ID>Nexus</ID> <URL>http://192.168.1.168:8081/repository/maven-public/</URL> </Repository> </distributionmanagement> <repositories> <Repository> <ID>Maven-public</ID> <URL>http://192.168.1.168:8081/repository/maven-public/</URL> <releases> <enabled>True</enabled> </releases> <Snapshots> <enabled>True</enabled> <Updatepolicy>Daily</Updatepolicy> <!--This element specifies how often the update occurs. Maven compares the timestamps of local pom and remote Pom. Here are the options: Always (all the time), daily (default, daily), interval:x (where X is the interval in minutes), or never (never). - </Snapshots> </Repository></repositories>
3. The POM reference jar in the project
Referring to the snapshot version, he will go to the repository type in the SNAPSHOT to find jars, note that after the version must add-snapshot, the release version of the direct write <version>1.27</version>;
After releasing the snapshot jar, you will need to perform the MAVEN test or maven install locally to update the jar
<Dependency> <groupId>Org2.kaola</groupId> <Artifactid>Fastdfs</Artifactid> <version>1.27-snapshot</version></Dependency>
V. Release of JAR Packages
How to use: Direct cmd enter the following command
1. Release version releases
MVN Deploy:deploy-file-dgroupid=org.kaola-dartifactid=fastdfs-dversion=1.25-dpackaging=jar-dfile=d:\fastdfs.jar -durl=http://192.168.1.168:8081/repository/maven-releases/-drepositoryid=nexus
2. Release version snapshots
MVN deploy:deploy-file-dgroupid=org2.kaola-dartifactid=fastdfs-dversion=1.27-snapshot-dpackaging=jar-dfile=d:\ fastdfs-snapshot.jar-durl=http://192.168.1.168:8081/repository/maven-snapshots/-DrepositoryId=nexus
Custom content Required:
DgroupId: Package grouping, such as Org.kaola,pom file <groupId>org.kaola</groupId> configuration
DartifactId: File name, pom file <artifactId>fastdfs</artifactId> config
Dversion: Version, pom file <version>1.27-SNAPSHOT</version> config
Dfile: Upload file Local path
Durl: Warehouse path, which warehouse to upload to
DrepositoryId: The ID configured in step 4-1 above
MAVEN build and use version-windows