maven setting.xml 字段注释翻译
程序员文章站
2022-06-13 09:47:41
...
<?xml version="1.0" encoding="UTF-8"?> <!-- 一项许可给Apache Software Foundation(ASF) 或更多贡献者许可协议。请参阅公告文件 随本作品分发以获取更多信息 关于版权所有权。 ASF许可此文件 根据Apache许可证2.0版(以下简称“ “执照”);除非合规,否则您不得使用此文件 与许可证。您可以在以下位置获得许可的副本: http://www.apache.org/licenses/LICENSE-2.0 除非适用法律要求或书面同意, 根据许可分发的软件将分发到 “按现状”,不提供任何保证或条件 明确或隐含的种类。请参阅许可证 特定语言的权限和限制 根据许可。 -> <!-- |这是Maven的配置文件。可以在两个级别上指定它: | | 1.用户级别。这个settings.xml文件为单个用户提供配置, |并且通常在$ {user.home} /。m2 / settings.xml中提供。 | |注意:可以使用CLI选项覆盖此位置: | | -s /path/to/user/settings.xml | | 2.全球水平。这个settings.xml文件提供了所有Maven的配置 |一台机器上的用户(假设他们都使用同一个Maven |安装)。通常在 | $ {maven.home} /conf/settings.xml。 | |注意:可以使用CLI选项覆盖此位置: | | -gs /path/to/global/settings.xml | |此样本文件中的各节旨在为您提供一个从 |充分利用您的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. | 本地存储库maven的路径将用于存储工件。 | | Default: ${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是否在需要输入时提示您.如果设置为false, | | maven will use a sensible default value, perhaps based on some other setting, for | 则maven将使用合理的默认值(可能基于其他设置) | | the parameter in question. | 作为参数。 | | Default: true <interactiveMode>true</interactiveMode> --> <!-- offline | Determines whether maven should attempt to connect to the network when executing a build. | 确定执行构建时,maven是否应尝试连接到网络。 | | This will have an effect on artifact downloads, artifact deployment, and others. | 这将对工件下载,工件部署等产生影响。 | | Default: 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 | 调用“ mvn prefix:goal”之类的命令行时。 Maven将自动添加组标识符 | | "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list. | 如果“ 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. | 将使用此列表中标记为活动的规范。 |--> <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. | 这是身份验证配置文件的列表,由系统内使用的服务器ID键入密钥。 | | Authentication profiles can be used whenever maven must make a connection to a remote server. | 只要maven必须连接到远程服务器,就可以使用身份验证配置文件。 | |--> <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). | 系统内的唯一名称(以下称为“ id”属性)。 | | | NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are | used together. | 注意:您应该指定用户名/密码或privateKey /密码,因为这些配对是 | 一起使用。 | <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. | 它的工作方式是这样的:POM可以声明一个存储库以用于解决某些工件。 | | 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 | 该存储库定义将具有唯一的ID,因此我们可以为此创建一个镜像引用 | | repository, to be used as an alternate download site. The mirror site will be 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 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. | | 指定要使用的存储库镜像站点而不是给定的存储库。 那个仓库 | 此镜像服务的ID与该镜像的mirrorOf元素匹配。 使用ID | 用于继承和直接查找目的,并且在整个镜像集中必须唯一 <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. | |这是配置文件的列表,可以通过多种方式激活这些配置文件,并可以对其进行修改 |构建过程。 settings.xml中提供的配置文件旨在提供本地计算机- |允许构建在本地环境中工作的特定路径和存储库位置。 | |例如,如果您有一个集成测试插件(例如仙人掌),则需要知道在哪里 |您的Tomcat实例已安装,您可以在此处提供一个变量,以便该变量为 |在构建过程中取消引用以配置cactus插件。 | |如上所述,可以以多种方式激活配置文件。一种方法-activeProfiles |本文档(settings.xml)部分-稍后将进行讨论。本质上是另一种方式 |依赖于系统属性的检测,该属性匹配该属性的特定值, |或仅仅测试其存在。还可以通过JDK版本前缀激活配置文件,其中 |当在JDK版本“ 1.4.2_07”上执行构建时,值“ 1.4”可能会激活概要文件。 |最后,可以从命令行直接指定活动配置文件的列表。 | |注意:对于settings.xml中定义的配置文件,只能指定为工件 |存储库,插件存储库和*格式属性(用作配置) | 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. | | 指定要使用以下一个或多个激活的构建过程的一组简介。 | 上述机制。 为了继承,并通过<activatedProfiles />激活配置文件 | 或命令行,配置文件必须具有唯一的ID。 | | 建议的个人资料识别最佳做法是使用一致的命名约定 | 用于配置文件,例如“ env-dev”,“ env-test”,“ env-production”,“ user-jdcasey”,“ user-brett”等。 | 这将使您更直观地了解这组引入的配置文件正在尝试什么 | 要完成的任务,特别是当您仅具有用于调试的配置文件ID的列表时。 | | 此概要文件示例使用JDK版本触发激活,并提供了特定于JDK的存储库。 <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: | | 这是另一个配置文件,由系统属性“ 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. | <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. | <activeProfiles> <activeProfile>alwaysActiveProfile</activeProfile> <activeProfile>anotherAlwaysActiveProfile</activeProfile> </activeProfiles> --> </settings>