User settings configuration for maven in eclipse

Source: Internet
Author: User
Tags object model

Maven is an open source project management tool written in pure Java that uses a concept called the POM (Project Object Model) to manage projects. All project configuration information is defined in a file called Pom.xml, through which Maven can manage the entire lifecycle of a project, including compiling, building, testing, publishing, reporting, etc.

Maven configuration file Settings.xml exists in two places:

1. Place of installation: ${m2_home}/conf/settings.xml

2. User's Directory: ${user.home}/.m2/settings.xml

The former is also called global configuration, which takes effect for all users of the operating system, which is referred to as User Configuration and is only valid for the current operating system's consumers. If both are present, their contents will be merged, and the user-scoped settings.xml will overwrite the global settings.xml.

After Maven is installed, Settings.xml is not automatically generated under the user directory, only the global configuration file. If you need to create a user-scoped settings.xml, you can copy the settings under the installation path to the directory ${user.home}/.m2/. Maven default settings.xml is a template that contains comments and examples that can be quickly modified to meet your requirements.

Once the global configuration is changed, all users will be affected, and if MAVEN is upgraded, all configurations will be cleared, so copy and backup ${m2_home}/conf/in advance. settings.xml files, it is generally not recommended to configure global settings.xml.

The default local warehouse path for configuring Settings.xml in Eclipse, as shown in Figure 1 and Figure 2, is the local warehouse path that has been customized: settings.xml configuration file.

Turn on Maven, Windows->preferences, Eclipse,


Figure 1


Figure 2

1. MAVEN has an important document "Settings.xml", this file from apache-maven-2.0.8/conf/, to be placed under window, Win7 and WinXP still a little different, Win7---C:\Users\ User name \.m2, WINXP---C:\Documents and settings\ user name \.m2. 2. Set up the MAVEN environment variable, basically similar to setting the JDK environment variable, first set maven_home, then add path. 3. Modify the "settings.xml" file to find the <localRepository>d:/work</localRepository> in this file and make changes. This line represents the location of MAVEN's jar-Package warehouse. Work is decentralized with the jar packages that the project uses, and each project can share one work.

4. Myeclipse7.5 and above itself comes with the Maven plugin. If you need to install a plugin using a lower version of MyEclipse, select software Updates from the Help menu, select Find and install, select Search for new features to install-select New remote Site Write Name:maven url:http://M2eclipse.codehaus. org/update/to download the relevant jar packages and plugins. 5. In MyEclipse windows-perferences, on the location of the figure below, see if the path to the users settings is correct. 6. Build maven Project,file--new-other-java maven Project. 7. Then open project Pom.xml file,

1 2 3 4 5 6 7 8 9 Ten-page All-in < Projectxmlns = "http// maven.apache.org/pom/4.0.0 "xmlns:xsi =" http://www.w3.org/2001/XMLSchema-instance "xsi:schemalocation ="/http/ Maven.apache.org/pom/4.0.0http://maven.apache.org/maven-v4_0_0.xsd "> < modelversion >4.0.0</ Modelversion > < groupId >maventest</groupId > < Artifactid >maventest</artifactid > < PAC Kaging >jar</Packaging > < version >0.0.1-snapshot</version > < name >mavenquickstartarchety pe</name > < URL >http://maven.apache.org</url > <
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.