Two problems to be solved by using nexus under restricted network

Source: Internet
Author: User
Tags apache tomcat sonatype

With a limited network, there are always two problems with the Nexus, which gives you a headache. I have a headache, in order not to let everyone headache, put the solution here for your reference. Issue one, background: Nexus cannot update the index of the remote repository due to network reasons. Solution 1:1, first update the index on the machine that can connect to the remote repository, it is recommended to use Eclipse Maven plugin, turn on full index, and then update the index, it will take a while. 2, find this directory: Local REPOSITORY\.CACHE\M2E\1.4.0\26522E0D83A422EED93329ECE7565CFC (Find time the latest one) \full there are some such documents. 3, copy all the files in this directory to%NEXUS_HOME%\SONATYPE-WORK\NEXUS\INDEXER\CENTRAL-CTX I am here to choose the central Warehouse, Central-ctx. Depending on your situation, put the index in the appropriate folder. Also, empty before copyingCentral-ctx Folder

4. Restart the Nexus

Solution 2:1, directly connect to the remote repository locally, download the following two files:
Http://repo1.maven.org/maven2/.index/nexus-maven-repository-index.properties
Http://repo1.maven.org/maven2/.index/nexus-maven-repository-index.gz
My experience is that by updating the index directly from the Eclipse Maven plugin, these two files are automatically downloaded.


2. Find an Apache Tomcat server and create a/maven2/.index virtual directory under its root (root) (Note: If you are using an XP system, you may not be able to build the. Index folder, which can be created under CMD using the mkdir command), Copy the above two files to the directory, and modify the Tomcat service port to 80.

3. Edit the C:\WINDOWS\system32\drivers\etc\hosts file and add it in the file:
127.0.0.1 repo1.maven.org
Note: 127.0.0.1 is the Apache Tomcat server IP address for step 2.
4, Login nexus, right-click on the remote warehouse to select Update Index
5. Remove the content previously added to the Hosts file.

Second, background: Nexus can update the index, but when I use the eclipse in the construction of MAVEN, I will go to the Nexus download jar, and the Nexus only index, no jar, theoretically, should go to the remote repository download, but due to network reasons can not be downloaded. I can download these jars myself directly to the central repository without using the private one, but I have to make sure that these jars must also be on the nexus, because not only do I use these jars myself, but a lot of my colleagues have to use them, and not everyone has to go to the central repository to download them, that's too much trouble. Solution: 1, first update the index on the nexus to ensure that its index is up to date. 2. Then use local maven to directly connect to the central repository and build your own project, and Maven will automatically download the required jar. 3, copy the local warehouse to the Nexus warehouse. Location:%nexus_home%\sonatype-work\nexus\storage\ the corresponding library folder.

Two problems to be solved by using nexus under restricted network

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.