settings.xml的文件配置大全

settings.xml 文件中最常配置的还是这几个标签
localRepositorymirrors

settings.xml文件官方文档地址

xml 复制代码
<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 https://maven.apache.org/xsd/settings-1.0.0.xsd">
  
    <!-- 本地仓库的路径 -->
    <localRepository>${user.home}/.m2/repository</localRepository>
    <!-- 是否时交互式,默认式true
    当用户可能需要为 Maven 提供额外的输入或作出决策时,interactiveMode被设置为true是非常有用的
    当用在ci\cd功能中时,则不希望有这种需要交互的程序,此时需要设置成false -->
    <interactiveMode>true</interactiveMode>
    <!-- 是否应用离线模式,默认false -->
    <offline>false</offline>
    
    <!-- 当你在命令行中使用插件时,可以省略该插件的 groupId。例如,mvn compiler:compile 会默认为 
org.apache.maven.plugins 的 groupId,因此你不需要指定完整的 groupId,如 mvn org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile。 -->
  	<pluginGroups>
    	<pluginGroup>org.apache.maven.plugins</pluginGroup>
	</pluginGroups>
	
    <!-- 用于身份的验证,该内容需要和项目中的pom.xml的distributionManagement的id匹配 -->
    <servers>
        <server>
            <id>my-remote-repository</id>
            <username>admin</username>
            <password>password123</password>
        </server>
    </servers>
    
    <!-- 中央仓库的镜像仓库地址配置 -->
  	<mirrors>
      <mirror> 
            <id>alimaven</id>  
            <name>aliyun maven</name>  
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
            <mirrorOf>central</mirrorOf> 
      </mirror>
  	</mirrors>
  	
    <!-- 当你运行 Maven 构建并且 Maven 需要从远程仓库检索依赖项或插件时,Maven 会使用这些代理设置来访问互联网。通过配置代理,你可以确保 Maven 请求走过你的代理服务器。 -->
  	<proxies>
       <proxy>
          <id>example-proxy</id>
          <active>true</active>
          <protocol>http</protocol>
          <host>proxy.example.com</host>
          <port>8080</port>
          <username>proxyuser</username>
          <password>somepassword</password>
          <nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
       </proxy>
    </proxies>
    
	<!-- profiles 标签用于定义特定于环境或情境的构建配置。这意味着,基于某些条件(例如系统属性、环境变量或文件存在性),你可以更改 Maven 构建的行为。它允许开发者在不更改主要的 POM 配置的情况下,为特定的环境或目的定制构建。 -->
    <profiles>
        <profile>
            <id>windows-profile</id>
            <activation>
                <os>
                    <family>Windows</family>
                </os>
            </activation>
            <properties>
                <path.separator>\</path.separator>
            </properties>
        </profile>

        <profile>
            <id>unix-profile</id>
            <activation>
                <os>
                    <family>unix</family>
                </os>
            </activation>
            <properties>
                <path.separator>/</path.separator>
            </properties>
        </profile>
    </profiles>
    <!-- activeProfiles 标签被用来指定默认情况下需要被激活的 profiles。 -->
    <activeProfiles>
       <activeProfile>dev-profile</activeProfile>
    </activeProfiles>
</settings>

nexus 私服信息一般时配置到pom.xml文件中,作为项目私有。

相关推荐
wpyok1683 小时前
密钥检测错误代码xml构建
xml
林开落L3 小时前
从入门到了解:Protobuf、JSON、XML 核心解析(C++ 示例)
xml·c++·json·protobuffer·结构化数据序列化机制
猫头虎16 小时前
如何排查并解决项目启动时报错Error encountered while processing: java.io.IOException: closed 的问题
java·开发语言·jvm·spring boot·python·开源·maven
介一安全18 小时前
【Web安全】XML注入全手法拆解
xml·web安全·安全性测试
凯尔萨厮21 小时前
Maven(Windows下载安装)
笔记·maven
亓才孓1 天前
[Maven]Maven基础
java·maven
我真会写代码2 天前
SSM(指南一)---Maven项目管理从入门到精通|高质量实操指南
java·spring·tomcat·maven·ssm
vx1_Biye_Design2 天前
基于Spring Boot+Vue的学生管理系统设计与实现-计算机毕业设计源码46223
java·vue.js·spring boot·spring·eclipse·tomcat·maven
qq_336313933 天前
javaweb-maven单元测试
java·开发语言·maven
计算机毕设指导63 天前
基于微信小程序的校园二手交易系统【源码文末联系】
java·spring boot·spring·微信小程序·小程序·tomcat·maven