1.hosted, host warehouse, deploy its own jar to this type of warehouse, including releases and snapshot, releases company internal release repository, snapshots Internal testing version of the warehouse 2.proxy, Agent warehouse, used for proxy remote public warehouses, such as the MAVEN central warehouse, the user connected to the central warehouse to download the jar package or plug-in. 3.group, Warehouse group, used to consolidate multiple hosted/proxy warehouses, usually we configure our own MAVEN Connection warehouse group. 4.virtual (virtual): Compatible with the MAVEN1 version of the jar or plugin note: The Nexus Warehouse is required by default in the Sonatype-work directory: make the Ssh_dao project into a jar package and put it on the VPN. Configure the first step: You need to configure the MAVEN environment on a computer where the client is deploying DAO engineering, andModify Settings.xmlFile, configure the user and password for the connection. This user name and password are used for the check-in, as it needs to know if the account and password for uploading are consistent with the account and password in the secret. <server> <id>releases</id> <username>admin</username> <password>admin12 3</password> </server><server> <id>snapshots</id> <username>admin</use Rname> <password>admin123</password> </server> releases is connected to the Release build project warehouse snapshots Connected is the beta version of the Project warehouse Step Two:Configuration Item Pom.xmlConfigure the address of the repository, the company's own jar package will be uploaded to the host warehouse, according to the project version number to decide which host warehouse to upload,
If the version is release, upload to the release warehouse, if the version is snapshot upload to the snapshot warehouse <distributionManagement> <repository> <id>releases</id><url>http://localhost:8081/nexus/content/repositories/releases/</url> </repository> <snapshotRepository> <id>snapshots</id><url>http://localhost:8081/ nexus/content/repositories/snapshots/</url> </snapshotRepository> </distributionManagement> Note: Pom.xml here <id> and maven in settings.xml configuration <id> corresponding! Test will project DAO engineeringmake a jar packagePublish to: 1, firstStart Nexus2. Execution of DAO ProjectDeployCommand
Download the jar package requirement from the server: if the local repository is not available, go to the central warehouse to download it before the Nexus is configured, usually a server is deployed in the enterprise on the LAN, with a local project first go to the local warehouse to find the jar,
If it is not found, then the private server downloads the jar package, if the server does not have a jar and also acts as a proxy to download the jar package from the Central warehouse, the advantage is that the company
Project dependent jar package management, on the one hand to improve the download speed, the project connected to download the jar package is faster than the project to connect to the central warehouse. This example tests the DAO Project jar package from the download.Manage Warehouse Groups: The nexus includes a lot of warehouses, hosted in the company's own release of the jar package and the third-party company's jar package, the proxy is stored in the Central warehouse jar, in order to facilitate the
The download jar package can compose multiple warehouses into a single warehouse group, and each project requires a repository group to download the jar package.Configuring the warehouse in Setting.xml: The repository configured in Setting.xml in the client's Maven, because Setting.xml does not have a repositories configuration taguse profile to define silosLibrary. <profile> <!--profile id--> <id>dev</id> <repositories> <repository& Gt <!--warehouse Id,repositories can configure multiple warehouses to ensure that IDs are not duplicated--<id>nexus</id> <!--warehouse Address--the address of the Nexus Warehouse Group---& lt;url>http://localhost:8081/nexus/content/groups/public/</url> <!--Download releases components--<release S> <enabled>true</enabled> </releases> <!--download Snapshots Components--&L t;snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <!--plugin repositories, maven run dependent plugins, and download plugins from the <plugin Repository> <!--The ID of the plugin warehouse is not allowed to repeat, if the repeat configuration will overwrite front--<id>public</id> < Name>public repositories</name> <url>http://localhost:8081/nexus/content/groups/public/</ur L> </pluginrepository> </pluginRepositories> </profile> Using profile to define the warehouse requires activation to take effect 。 <activeProfiles> <activeProfile>dev</activeProfile> </activeProfiles> After a successful configuration, the effective Pom is the final pom content of the Maven software, and the programmer does not directly edit the effective pom to open the valid pom effective pom content as follows: There are two warehouse addresses in the POM content below, and Maven will first look from the front of the warehouse, If the jar package is not found and then looked up from the bottom, the download of the jar package is realized. <repositories> <repository> <releases> <enabled>true</enabled> </rele ases> <snapshots> <enabled>true</enabled> </snapshots> <ID>PUBLIC&L t;/id> <name>public repositories</name> <url>http://localhost:8081/nexus/content/groups/pub lic/</url> </repository> <repository> <snapshots> <enabled>false</enabl ed> </snapshots> <id>central</id> <name>central repository</name> < ;url>https://repo.maven.apache.org/maven2</url> </repository> </repositories> < Pluginrepositories> <pluginrepository> <id>public</id> <name>public repositories</name> <url>http://local host:8081/nexus/content/groups/public/</url> </pluginRepository> <pluginRepository> <relea ses> <updatePolicy>never</updatePolicy> </releases> <snapshots> <ena bled>false</enabled> </snapshots> <id>central</id> <name>central repositor y</name> <url>https://repo.maven.apache.org/maven2</url> </pluginRepository> </pluginr Epositories>
Nexus's jar package upload and download