Settings.xml)

Source: Internet
Author: User

1. User level.

${user.home}/.m2/settings.xml

2. Global level.

${maven.home}/conf/settings.xml

<settings>

    1. Localrepository
    2. Interactivemode
    3. Offline
    4. Plugingroups
    5. Proxies
    6. Servers
    7. Mirrors
    8. Profiles
    9. Activeprofiles

</settings>

<?XML version= "1.0" encoding= "UTF-8"?><!--Licensed to the Apache software Foundation (ASF) under Oneor more contributor license agreements.  See the NOTICE filedistributed with this work for additional informationregarding copyright ownership. The ASF licenses this fileto you under the Apache License, Version 2.0 (the "License");  Except in Compliancewith the License. Obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or Agreed to Writing,software distributed under the License are distributed on a "as is" BASIS, without warranties OR Condi  tions of Anykind, either express or implied. See the License for Thespecific language governing permissions and Limitationsunder the License. -<!-- | The configuration file for Maven.  It can specified at levels: | | 1. User level.                 This settings.xml file provides configuration for a single user, | and is normally provided in ${user.home}/.m2/settings.xml.                 | |                 Note:this location can is overridden with the CLI option: | |  -s/path/to/user/settings.xml | | 2. Global level.                 This settings.xml file provides configuration for all Maven |                 Users on a machine (assuming they ' re all using the same Maven | installation).                 It ' s normally provided in | ${maven.home}/conf/settings.xml.                 | |                 Note:this location can is overridden with the CLI option: | | -gs/path/to/global/settings.xml | | The sections in this sample file is intended to give you a running start at | Getting the most out of your Maven installation. Where appropriate, the default | VALUES (values used when the setting isn't specified) are provided. | | -<Settingsxmlns= "http://maven.apache.org/SETTINGS/1.0.0"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xsi:schemalocation= "http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">  <!--Localrepository |   The path to the local repository maven would use to store artifacts.   | | Default: ~/.m2/repository <localRepository>/path/to/local/repo</localRepository> -  <!--Interactivemode | This would determine whether Maven prompts when it needs input. If set to False, | Maven would use a sensible default value, perhaps based on some other setting, for |   The parameter in question.   | | Default:true <interactiveMode>true</interactiveMode> -  <!--Offline |   Determines whether MAVEN should attempt to connect to the network when executing a build. |   This is a effect on artifact downloads, artifact deployment, and others.   | | Default:false <offline>false</offline> -  <!--plugingroups |   This was a list of additional group identifiers that would be searched when resolving plugins by their prefix, i.e. | When invoking a command line like "Mvn prefix:goal". Maven would automatically add the group identifiers |   "Org.apache.maven.plugins" and "Org.codehaus.mojo" if these is not already contained in the list. | -  <plugingroups>    <!--Plugingroup |    Specifies a further group identifier to use for plugin lookup. <pluginGroup>com.your.plugins</pluginGroup> -  </plugingroups>  <!--Proxies |   This is a list of proxies which can being used on the the network. | Unless otherwise specified (by system property or command-line switch), the first proxy |   Specification in this list marked as active would be used. | -  <proxies>    <!--Proxy |     Specification for one proxy, to is used in connecting to the network.    | <proxy> <id>optional</id> <active>true</active> <protocol>http</prot ocol> <username>proxyuser</username> <password>proxypass</password>  -  </proxies>  <!--Servers |   This was a list of authentication profiles, keyed by the Server-id used within the system. |   Authentication profiles can is used whenever Maven must make a connection to a remote server. | -  <Servers>    <!--Server | Specifies the authentication information to use if connecting to a particular server, identified by |     A unique name within the system (referred to by the ' id ' attribute below).      | |       Note:you should either specify Username/password OR privatekey/passphrase, since these pairings are |     Used together.    | <server> <id>deploymentRepo</id> <username>repouser</username> <PASSWORD&G T;repopwd</password> </server> -        <!--another sample, using keys to authenticate. <server> <id>siteServer</id> <privateKey>/path/to/private/key</privateKey> &L t;passphrase>optional; Leave empty if not used.</passphrase> </server> -  </Servers>  <!--Mirrors |   This was a list of mirrors to being used in downloading artifacts from remote repositories.    | |   It works like This:a POM could declare a repository to use in resolving certain artifacts. | However, this repository is problems with heavy traffic at times, so people has mirrored |   It to several places.   | | That repository definition would has a unique ID, so we can create a mirror reference for that | Repository, to is used as an alternate download site. The mirror site would be the The preferred |   Server for that repository. | -  <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>mirrorId</id> <mirrorOf>repositoryId</mirrorOf> <name>huma N Readable Name for this mirror.</name> <url>http://my.repository.com/repo/path</url> </mirro R> -  </Mirrors>    <!--  Profiles | This is a list of profiles which can being activated in a variety of ways, and which can modify | The build process. Profiles provided in the settings.xml is intended to provide local machine-|   Specific paths and repository locations which allow the build to work in the local environment.   | | For example, if you have a integration testing plugin-like cactus-that needs to know where | Your Tomcat instance is installed, you can provide a variable here such that's the variable is |   dereferenced during the build process to configure the Cactus plugin.   | | As noted above, profiles can be activated in a variety of ways. One way-the activeprofiles | section of this document (Settings.xml)-'ll be discussed later. Another-essentially | Relies on the detection of a system property, either matching a particular value for the property, | or merely testing its existence. Profiles can also is activated by JDK version prefix, where a | Value of ' 1.4 ' Might activate a profile when the build was executed on a JDK version of ' 1.4.2_07 '. |   Finally, the list of active profiles can specified directly from the command line.   | |       NOTE:FOR profiles defined in the settings.xml, you is restricted to specifying only artifact |       Repositories, plugin repositories, and Free-form properties to be used as configuration |   Variables for plugins in the POM.   | | -  <Profiles>    <!-- Profile | Specifies a set of introductions to the build process, to is activated using one or more of the | Mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/> |     or the command line, profiles has an ID of that is unique.     | | An encouraged best practice for profile identification are to use a consistent naming convention |     For profiles, such as ' Env-dev ', ' env-test ', ' env-production ', ' User-jdcasey ', ' User-brett ', etc. | This'll make it more intuitive to understand what's the set of introduced profiles is attempting |     To accomplish, particularly if you are only having a list of profile IDs ' s for Debug.     | |    This profiles example uses the JDK version to trigger activation, and provides a jdk-specific repo. <profile> <id>jdk-1.4</id> <activation> <jdk>1.4</jdk> </acti  Vation> <repositories> <repository>        <id>jdk14</id> <name>repository for JDK 1.4 builds</name> <url>htt P://www.myhost.com/maven/jdk14</url> <layout>default</layout> <snapshotpolicy>al     ways</snapshotpolicy> </repository> </repositories> </profile> -    <!--     | Here is another profiles, activated by the system property ' Target-env ' with a value of ' Dev ', | which provides a specific path to the Tomcat instance. To use this, your plugin configuration |     Might hypothetically look like: | | ...     |   <plugin> |   <groupId>org.myco.myplugins</groupId> |        <artifactId>myplugin</artifactId> |   |     <configuration> |   <tomcatLocation>${tomcatPath}</tomcatLocation> | </configuration> | </plugin> |     ...     | |       Note:if just wanted to inject the configuration whenever someone set ' target-env ' to |     Anything, you could just leave off the <value/> inside the activation-property.    | <profile> <id>env-dev</id> <activation> <property> <name>tar get-env</name> <value>dev</value> </property> </activation> <properties> <tomcatPath>/path/to/tomcat/instance</tomcatPath> </properties> </p     Rofile> -  </Profiles>  <!--Activeprofiles |   List of profiles that is active for all builds.  | <activeProfiles> <activeProfile>alwaysActiveProfile</activeProfile> <activeProfile> Anotheralwaysactiveprofile</activeprofile> </activeProfiles> -</Settings>
View Code

Click to view syntax

1. Set the local warehouse location

| Default: ${user.home}/.m2/repository

<localRepository>${somedir}</localRepository>

2. Whether to enable interactive mode

| Default:true
<interactiveMode>true</interactiveMode>

3. Whether to enable offline mode

| Default:false
<offline>false</offline>

4. Specify the plugin search location

<pluginGroups>
<!--Plugingroup
| Specifies a further group identifier to use for plugin lookup.
<pluginGroup>com.your.plugins</pluginGroup>
-
</pluginGroups>

5. Set up proxy 6. Configure warehouse Access 7. Configure mirroring

<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>mirrorId</id>
<mirrorOf>repositoryId</mirrorOf>
<name>human readable name for this mirror.</name>
<url>http://my.repository.com/repo/path</url>
</mirror>
-
</mirrors>

When a (Repositoryid) warehouse is unavailable, set up the mirror server for this warehouse

8. Configuration Files

Settings.xml)

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.