maven 私服的setting的配置

<?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.
-->

<!--
 | This is the configuration file for Maven. It can be specified at two 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 be 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.conf}/settings.xml.
 |
 |                 NOTE: This location can be overridden with the CLI option:
 |
 |                 -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.
 |
 |-->
<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
  <localRepository>/path/to/local/repo</localRepository>
  -->
  <localRepository>E:\repository</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
  <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
  <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.
   |-->
  <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.
   | Authentication profiles can be used whenever maven must make a connection to a remote server.
   |-->
  <!-- 设置发布时的用户名 -->
  <servers>
    <server>
      <id>zlrelease</id>
      <username>zl</username>
      <password>yz18931904</password>
    </server>
    <server>
      <id>zlsnapshots</id>
      <username>zl</username>
      <password>yz18931904</password>
    </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.
   |-->
  <mirrors>
    <mirror>
      <!--此处配置所有的构建均从私有仓库中下载 *代表所有,也可以写central -->
      <id>nexus</id>
      <!-- 拦截下来所有的仓库做镜像 -->
      <mirrorOf>*</mirrorOf>
      <url>http://192.168.47.128:8081/nexus/content/groups/public/</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>
      <id>nexus</id>
      <!--所有请求均通过镜像,配置一个假的中央仓库地址,重写中央仓库的路径地址 -->
      <repositories>
        <repository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>

  <!-- 激活profiles -->
  <activeProfiles>
    <!--make the profile active all the time -->
    <activeProfile>nexus</activeProfile>
  </activeProfiles>
</settings>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: Maven 仓库 Setting 配置是指在使用 Maven 构建项目时,通过修改 Mavensettings.xml 文件来配置 Maven 仓库的相关信息。Maven 仓库是用于存储和获取 Maven 构建所需的依赖项的地方。 在 settings.xml 文件中,可以配置以下几个重要的信息: 1. 仓库的位置:可以配置本地仓库的路径,默认情况下,Maven 会将构建所需的依赖项下载到本地仓库。可以通过 `<localRepository>` 元素来配置本地仓库的路径。 2. 远程仓库:除了本地仓库,还可以配置远程仓库,用于从远程服务器下载依赖项。可以通过 `<repositories>` 元素来配置远程仓库的 URL、用户名和密码等信息。可以配置多个远程仓库,Maven 会按照配置的顺序依次从这些仓库下载依赖。 3. 镜像仓库:可以配置镜像仓库,用于加速下载依赖项的速度。镜像仓库是指将某个远程仓库的内容复制到本地的一个仓库,Maven 在下载依赖项时,会先尝试从镜像仓库下载,如果下载失败才会尝试从远程仓库下载。可以通过 `<mirrors>` 元素来配置镜像仓库的 URL。 4. 代理服务器:如果在访问远程仓库时需要通过代理服务器,可以通过 `<proxies>` 元素来配置代理服务器的主机名、端口号、用户名和密码等信息。 通过修改 settings.xml 文件中的这些配置,可以自定义 Maven 仓库的行为,例如修改本地仓库的路径、配置多个远程仓库以提高依赖项的下载速度、配置镜像仓库以减轻远程仓库的负载、配置代理服务器以在访问远程仓库时绕开限制等。 总之,通过 Maven 仓库 Setting 配置,我们可以灵活地管理和配置 Maven 的仓库,以满足不同项目的需求,提高构建效率和稳定性。 ### 回答2: Maven仓库的setting配置是指在使用Maven构建项目时,设置Maven本地仓库和远程仓库的相关参数。设置Maven仓库有助于管理依赖项、版本控制和依赖关系的管理。 Maven仓库的setting配置信息通常包括两个部分,分别是本地仓库和远程仓库。 本地仓库是指在本地计算机上存储项目依赖项的位置。通常情况下,本地仓库位于用户目录下的.m2文件夹中。setting配置需要指定本地仓库的路径,例如:`<localRepository>/path/to/local/repository</localRepository>`。 远程仓库是指存储在远程服务器上的项目依赖项。通常情况下,在pom.xml文件中会指定项目所需的远程仓库地址。设置远程仓库需要配置`<repositories>`和`<pluginRepositories>`节点,分别用于指定项目依赖项和插件依赖项的仓库地址。 在setting文件中,还可以配置镜像仓库的地址,用于提高Maven构建的速度和稳定性。镜像仓库是指存储在其他服务器上的与远程仓库相同的项目依赖项。配置镜像仓库可以加速下载依赖项的速度。 除了仓库的设置,setting文件还包含一些其他的全局配置,如代理服务器、全局配置文件等。 总之,Maven仓库的setting配置是指在使用Maven构建项目时,设置相关的本地仓库、远程仓库和镜像仓库的信息。这些配置有助于管理项目的依赖项和插件依赖关系,并能提高构建的速度和稳定性。 ### 回答3: Maven仓库的setting配置是用于指定Maven构建工具获取和存储构件(即编译后的文件)的地方。在Maven中,setting配置文件是settings.xml,默认位于Maven安装目录的conf文件夹下。 配置文件中的相关元素包括: 1. 仓库类型(repository):可以是本地的(local)或远程的(remote)仓库。本地仓库是Maven默认的仓库,用于存储本地构件,一般位于用户目录下的.m2文件夹。远程仓库是从各种仓库服务器上下载构件的地方,可以是公共的(如Maven中央仓库),也可以是私有的。 2. 仓库的URL(url):对于远程仓库,需要指定其URL地址。Maven中央仓库的URL是https://repo.maven.apache.org/maven2/。对于本地仓库,URL是本地文件系统的路径。 3. 仓库的ID(id):用于在配置文件中标识不同的仓库。一般来说,本地仓库的ID是local,而远程仓库的ID可以是任意取名。 4. 认证信息(authentication):用于访问需要身份验证的仓库。认证信息包括用户名和密码。 通过在setting配置文件中添加或修改这些元素,可以配置Maven使用的仓库。 除了配置仓库,setting配置文件还可用于配置其他方面的信息,如代理服务器、镜像仓库等。 总而言之,Maven仓库的setting配置就是通过Mavensetting.xml文件来指定仓库的类型、URL、身份验证等信息,用于获取和存储构件的位置。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值