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文件中,作为项目私有。

相关推荐
练习时长一年20 分钟前
浅谈assembly插件打包分发机制
xml
Chasing Aurora26 分钟前
整理常用的开发工具使用问题和小贴士(二)——软件和浏览器
redis·python·mysql·maven
卓怡学长2 小时前
w1基于springboot高校学生评教系统
java·spring boot·tomcat·maven·intellij-idea
improvement...2 小时前
Maven 编译打包全指南:整体 / 逐个打包 + 核心参数详解
java·maven
d_dreamer17 小时前
SeaTunnel推荐Maven版本
java·maven
卓怡学长18 小时前
m326数据结构课程网络学习平台的设计与实现+vue
java·spring·tomcat·maven·intellij-idea·mybatis
橘子编程1 天前
Hermes Agent 完整知识总结与使用教程
java·人工智能·ai·tomcat·maven·ai编程
Yeh2020581 天前
maven
java·maven
卓怡学长1 天前
基于 SpringBoot 的生活信息分享平台,从 0 到 1 完整实现(附源码 + 数据库)
java·数据库·spring boot·tomcat·maven
不吃香菜学java1 天前
Redis简单应用
数据库·spring boot·tomcat·maven