Maven 原生 settings.xml 说明【翻译】

 <?xml version="1.0" encoding="UTF-8"?>

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.

根据一个或多个贡献者许可协议授权给Apache Software Foundation (ASF)。
有关版权所有者的更多信息,请参见随本作品分发的通知文件。ASF根据Apache 
2.0版本(“许可”)向您许可此文件;除非符合许可证规定,否则您不得使用此文件。你可于

  http://www.apache.org/licenses/LICENSE-2.0

除非适用法律要求或书面同意,在许可下发布的软件是在“现状”的基础上发布的,
没有任何明示或暗示的担保或条件。有关控制许可证下的权限和限制的特定语言,请参见许可证。

localRepository、
interactiveMode、
usePluginRegistry、
offline、
proxies、
mirrors、
servers、
profiles、
activeProfiles、
pluginGroups
-->

<!--
 | This is the configuration file for Maven. It can be specified at two levels:
 | 这是Maven的配置文件。它可以在两个层次上指定:
 |
 |  1. User Level. This settings.xml file provides configuration for a single user,
 |                 and is normally provided in ${user.home}/.m2/settings.xml.
 |  1. 用户级别: 这个settingsxml文件为单个用户提供配置,通常在${user.home}/.m2/settings.xml中提供。
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |                 注: 这个位置可以用CLI选项覆盖:
 |
 |                 -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.conf}/settings.xml.
 |  2. 全局级别: 这个settings.xml为使用本计算机的所有用户同意提供配置(假设它们都使用相同的
 |                 Maven 安装包),通常它在${maven.conf}/settings.xml中。
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |                 注: 这个位置可以用CLI选项覆盖:
 |
 |                 -gs /path/to/global/settings.xml
 |
 | The sections in this sample file are 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 is not specified) are provided.
 | 这个示例文件中的部分旨在为您提供一个从Maven安装中获得最大收益的运行起点。在适当的情况下,
 | 提供默认值(未指定设置时使用的值)。
 |
 |-->
<settings xmlns="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 will use to store artifacts.
   |
   | Default: ${user.home}/.m2/repository
   |
   |   本地仓库
   | 本地储库路径将用于存储 maven artifacts.
   |
   | 默认值: ${user.home}/.m2/repository
   |
  <localRepository>/path/to/local/repo</localRepository>
  -->

  <!-- interactiveMode
   | This will determine whether maven prompts you when it needs input. If set to false,
   | maven will use a sensible default value, perhaps based on some other setting, for
   | the parameter in question.
   |
   | Default: true
   |
   | 交互模式
   | 这将决定maven在需要输入时是否提示您。如果设置为false, maven将为所讨论的参数使用一个合理的
   | 默认值(可能基于其他设置)。
   |
   | 默认: true
   |
  <interactiveMode>true</interactiveMode>
  -->

  <!-- offline
   | Determines whether maven should attempt to connect to the network when executing a build.
   | This will have an effect on artifact downloads, artifact deployment, and others.
   |
   | Default: false
   |
   | 离线
   | 确定maven在执行构建时是否应尝试连接到网络。这将对 artifact 下载、artifact 部署和其他方面产生影响。
   |
   | 默认: false
   |
  <offline>false</offline>
  -->

  <!-- pluginGroups
   | This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
   | when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
   | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
   |
   |   插件组
   | 这是一个附加组标识符的列表,当使用它们的前缀解析插件时,例如调用“mvn prefix:goal”这样的命令行时,将搜索这些组标识符。
   | Maven将自动添加组标识符“org.apache.maven.plugins”和“org.codehaus.mojo“。如果这些还没有包含在列表中。
   |-->
  <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 be used on this machine to connect to the network.
   | Unless otherwise specified (by system property or command-line switch), the first proxy
   | specification in this list marked as active will be used.
   |
   |   代理
   | 这是一个代理列表,可以在这台机器上使用它连接到网络。除非另外指定(通过系统属性或命令行开关),
   | 否则将使用此列表中标记为active的第一个代理规范。
   |
   |-->
  <proxies>
    <!-- proxy
     | Specification for one proxy, to be used in connecting to the network.
     |
     | 代理
     | 一个代理的配置规范,用于连接网络。
     |
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>proxyuser</username>
      <password>proxypass</password>
      <host>proxy.host.net</host>
      <port>80</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
    -->
  </proxies>

  <!-- servers
   | This is a list of authentication profiles, keyed by the server-id used within the system.
   | Authentication profiles can be used whenever maven must make a connection to a remote server.
   |
   |   服务
   | 这是一个身份验证 profile 列表,由系统中使用的 server-id 唯一标示。每当maven必须连接到远程服务器时,
   | 都可以使用身份验证 profile。
   |
   |-->
  <servers>
    <!-- server
     | Specifies the authentication information to use when 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.
     |
     | 服务
     | 指定连接到特定服务器时使用的身份验证信息,该信息由系统中的唯一名称标识(由下面的'id'属性引用)。
     |
     | 注: 你应该指定 username/password 或 privateKey/passphrase,因为这些对是一起使用的。
     |
    <server>
      <id>deploymentRepo</id>
      <username>repouser</username>
      <password>repopwd</password>
    </server>
    -->

    <!-- Another sample, using keys to authenticate.
     | 另一个使用密钥进行身份验证的示例。
    <server>
      <id>siteServer</id>
      <privateKey>/path/to/private/key</privateKey>
      <passphrase>optional; leave empty if not used.</passphrase>
    </server>
    -->
  </servers>

  <!-- mirrors
   | This is a list of mirrors to be used in downloading artifacts from remote repositories.
   |
   | It works like this: a POM may declare a repository to use in resolving certain artifacts.
   | However, this repository may have problems with heavy traffic at times, so people have mirrored
   | it to several places.
   |
   | That repository definition will have a unique id, so we can create a mirror reference for that
   | repository, to be used as an alternate download site. The mirror site will be the preferred
   | server for that repository.
   |
   | 镜像
   | 这是从远程存储库下载 artifact 时使用的镜像列表。
   |
   | 它的工作原理是这样的: POM 可以声明一个仓库,用于解析某些 artifact。然而,这个仓库有时可能会遇到流量过大的问题,
   | 因此人们将其镜像到几个地方。
   |
   | 该仓库定义将具有唯一的id,因此我们可以为该仓库创建镜像引用,作为备用下载站点使用。镜像站点将是该仓库的首选服务器。
   |
   |-->
  <mirrors>
    <!-- mirror
     | Specifies a repository mirror site to use instead of a given repository. The repository that
     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
     |
     |   镜像
     | 指定要使用的仓库镜像站点,而不是给定的仓库。此镜像所服务的仓库具有与此镜像的mirrorOf元素匹配的ID。
     | IDs用于继承和直接查找,并且必须在一组镜像中是惟一的。
     |
    <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>

  <!-- profiles
   | This is a list of profiles which can be activated in a variety of ways, and which can modify
   | the build process. Profiles provided in the settings.xml are 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 an integration testing plugin - like cactus - that needs to know where
   | your Tomcat instance is installed, you can provide a variable here such that 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) - will be discussed later. Another way 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 be activated by JDK version prefix, where a
   | value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
   | Finally, the list of active profiles can be specified directly from the command line.
   |
   | NOTE: For profiles defined in the settings.xml, you are 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 文件列表,可以以多种方式激活它,也可以修改构建过程。在设置中提供的 settings.xml 旨在提供本地特定于机器的
   | 路径和仓库位置,从而允许构建在本地环境中工作。
   |
   | 例如,如果您有一个集成测试插件(比如cactus),它需要知道 Tomcat 实例安装在哪里,那么您可以在这里提供一个变量,
   | 以便在构建过程中解除对该变量的引用来配置cactus插件。
   |
   | 如上所述,可以以多种方式激活 profile。一种方法—本文的activeProfiles部分(settings.xml)—将在稍后讨论。另一种方法
   | 本质上依赖于检测系统属性,要么匹配属性的特定值,要么仅仅测试其存在性。配置文件也可以通过JDK版本前缀激活,其中,
   | 当在JDK版本“1.4.2_07”上执行构建时,值为“1.4”的配置文件可能会激活。最后,可以直接从命令行指定活动 profile 的列表。
   |
   | 注: 对于在settings.xml中定义的 profile,只能指定 artifact 仓库、插件仓库和自由形式的属性作为POM中插件的配置变量。
   |
   |-->
  <profiles>
    <!-- profile
     | Specifies a set of introductions to the build process, to be activated using one or more of the
     | mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
     | or the command line, profiles have to have an ID that is unique.
     |
     | An encouraged best practice for profile identification is to use a consistent naming convention
     | for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.
     | This will make it more intuitive to understand what the set of introduced profiles is attempting
     | to accomplish, particularly when you only have a list of profile id's for debug.
     |
     | This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
     | 
     | profile
     | 指定要使用上面描述的一种或多种机制激活的构建过程的一组介绍。出于继承目的,为了通过<activatedProfiles/>或命令行激活profile,
     | profile 必须具有惟一的ID。
     |
     | 鼓励轮廓识别的最佳实践是为profile定义使用一致的命名惯例, 如‘env-dev’、‘env-test’,‘env-production’,‘user-jdcasey’,
     | ‘user-brett’,等。这将使它更直观了解概要介绍的是试图完成的,尤其是当你只有一个列表的配置id的调试。
     |
     | 这个profile示例使用JDK版本来触发激活,并提供特定于JDK的repo。
     |
    <profile>
      <id>jdk-1.4</id>

      <activation>
        <jdk>1.4</jdk>
      </activation>

      <repositories>
        <repository>
          <id>jdk14</id>
          <name>Repository for JDK 1.4 builds</name>
          <url>http://www.myhost.com/maven/jdk14</url>
          <layout>default</layout>
          <snapshotPolicy>always</snapshotPolicy>
        </repository>
      </repositories>
    </profile>
    -->

    <!--
     | Here is another profile, 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:
     |
     | 这是另一个profile,由系统属性“target-env”激活,值为“dev”,它提供了Tomcat实例的特定路径。
     | 要使用它,你的插件配置可能假设如下:
     |
     | ...
     | <plugin>
     |   <groupId>org.myco.myplugins</groupId>
     |   <artifactId>myplugin</artifactId>
     |
     |   <configuration>
     |     <tomcatLocation>${tomcatPath}</tomcatLocation>
     |   </configuration>
     | </plugin>
     | ...
     |
     | NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to
     |       anything, you could just leave off the <value/> inside the activation-property.
     |
     | 注: 如果您只想在某人将“target-env”设置为任何值时注入此配置,那么您可以在激活属性中保留<value/>。
     |
    <profile>
      <id>env-dev</id>

      <activation>
        <property>
          <name>target-env</name>
          <value>dev</value>
        </property>
      </activation>

      <properties>
        <tomcatPath>/path/to/tomcat/instance</tomcatPath>
      </properties>
    </profile>
    -->
  </profiles>

  <!-- activeProfiles
   | List of profiles that are active for all builds.
   |
   | 激活 Profile
   | 为所有构建活动的Profile列表。
   |
  <activeProfiles>
    <activeProfile>alwaysActiveProfile</activeProfile>
    <activeProfile>anotherAlwaysActiveProfile</activeProfile>
  </activeProfiles>
  -->
</settings>

展开阅读全文

没有更多推荐了,返回首页