Eclipse Settings maven Load domestic mirror

Source: Internet
Author: User
Tags java web

When you use the MAVEN Package Manager to develop the Java Web, you will always have to wait a long time to load the required jar packages because of the slow speed of the domestic network, or the wall, after creating project. This is a painful wait for the developer, and a loss for the business.

Today to meet the expert guidance, the MAVEN plugin in eclipse has been optimized configuration, the following step-by-step demonstration, to help the friends who need:

Linux/windows: After opening eclipse, window-"preferences-" maven

Mac:eclipse Preferences-"maven

Then select User Settings, such as:

Create a profile settings.xml according to the location indicated in Figure 3.

Linux/mac can be created using the following command, do not write anything, then save, vim command mode is: Wq, note: w is write, q is exit, Colon is the command to start

     ~$ Vim/home/joyven/.m2/settings.xml

Windows needs to be created as an administrator under the current user directory.

Then go back to the eclipse operation step, first close the preferences panel, again according to the previous steps, open this panel, you will see the user settings changes occurred, such as:

Yes, you are not wrong, more than a openfile. Click OpenFile, then apply, then OK, and finally close the panel. At this point, the settings.xml file created earlier has been opened in the Eclipse editing window.

The configuration begins, copy the following code into the Settings.xml file, and save it.

<settings xsi:schemalocation= "http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/ Settings-1.0.0.xsd "><mirrors><!--Mirror | Specifies a repository mirror site to use instead of a given repository. The Repository that | This mirror serves have an ID, that matches, the mirrorof element of this mirror. IDs is used | For inheritance and direct lookup purposes, and must is unique across the set of mirrors. | --><mirror><id>nexus-osc</id><mirrorof>central</mirrorof><name>nexus OSC </name><url>http://maven.oschina.net/content/groups/public/</url></mirror><mirror ><id>nexus-osc-thirdparty</id><mirrorof>thirdparty</mirrorof><name>nexus OSC thirdparty</name><url>http://maven.oschina.net/content/repositories/thirdparty/</url></ mirror></mirrors><profiles><profile><id>default</id><repositories>< repository><Id>nexus</id><name>local Private nexus</name><url>http://maven.oschina.net/content/ Groups/public/</url><releases><enabled>true</enabled></releases><snapshots ><enabled>false</enabled></snapshots></repository></repositories>< Pluginrepositories><pluginrepository><id>nexus</id><name>local Private Nexus</name ><url>http://maven.oschina.net/content/groups/public/</url><releases><enabled>true </enabled></releases><snapshots><enabled>false</enabled></snapshots></ Pluginrepository></pluginrepositories></profile></profiles></settings>



Test it: Create a MAVEN project in Eclipse, and in the console window of Eclipse, select Maven Console. You can see the source of the loaded package.

Bottom right corner of the inverted Triangle Arrow mouse hover up, there are many console list, select Maven Console, click to switch to the Maven window, you can see information about the download source, such as:

-------------------------------------------Supplemental Updates-------------------------------------------------------------------------- ----

Settings.xml file, the label <profile> must be included in <profiles>, otherwise there are some errors when executing mvn using the command line:

Error reading settings.xml:Unrecognised tag: ' Profile ' (Position:start_tag seen ... </mirrors>\n\n\t<profile& gt; .... @22:11)
Line:22
Column:11
[Email protected]:/mnt/workspace/spring-mvc$ mvn archetype:generate DGROUPID=JOYVEN-DARTIFACTID=SPRING-MVC- Darchetypeartifactid=maven-archetype-webapp

After the modification, there is no.

Add one point:

To create a project with Maven:

MVN archetype:generate Dgroupid=joyven-dartifactid=spring-mvc-darchetypeartifactid=maven-archetype-webapp


Description: Maven relies primarily on coordinates to differentiate project packages.

GroupId

Artifactid

Archetypeartifactid

Version

These four values reflect the uniqueness of the MAVEN package.

Eclipse Settings maven Load domestic mirror

Related Article

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.