美文网首页
mvn-settings文件翻译

mvn-settings文件翻译

作者: haoxpZzz | 来源:发表于2019-11-18 08:57 被阅读0次

    mvn配置文件 解释

    • 本文尽量将文章结构与settings.xml一致

    localrepository

    interactiveMode

    • 是否开启交互模式,若为false,将会用一些默认值替代用户输入(作者没改过)
    • 默认true

    offline

    • 离线模式,顾名思义,是否允许maven构建等操作时联网
    • 默认false(内网环境有用吧)

    pluginGroups

    • 在pluginGroups元素下面可以定义一系列的pluginGroup元素。
    • 表示当通过plugin的前缀来解析plugin的时候到哪里寻找。pluginGroup元素指定的是plugin的groupId。
    • 默认情况下,Maven会自动把org.apache.maven.plugins和org.codehaus.mojo添加到pluginGroups下。(注释翻译)

    proxies

    故名思意,联网代理

    servers

    • 当需要连接到一个远程服务器的时候需要使用到的验证方式
    • id对应服务器id(repository id)

    mirrors

    • 用来替换mirrorOf中的repository,将发送至respository中的请求转到该mirro
    • 私以为用处不大,简化配置时,直接用 * 替换所有镜像地址方便用

    profiles

    • profile元素由activation、repositories、pluginRepositories和properties四个元素组成。
    • 当一个profile在settings.xml中是处于活动状态并且在pom.xml中定义了一个相同id的profile时,settings.xml中的profile会覆盖pom.xml中的profile。

    activation

          <activation>
            <!-- true表示没有其他profile激活时,此profile被激活 -->
            <activeByDefault>true</activeByDefault>
            <!-- jdk 1.4-1.7 激活此profile -->
            <jdk>[1.4,1.7]</jdk>
            <!-- windows下激活 -->
            <os>
              <name>Windows 10</name>
              <family>Windows</family>
              <arch>x86</arch>
              <version>10.0.18362.476</version>
            </os>
            <!-- pom中包含property时激活 -->
            <property>
              <name>key</name>
              <value>value</value>
            </property>
            <!-- 文件存在活不存在时激活 -->
            <file>
              <exists>${basedir}/file2.properties</exists>
              <missing>${basedir}/file1.properties</missing>
            </file>
          </activation>
    

    repositories

    • 用于定义远程仓库的,当该profile是激活状态的时候,这里面定义的远程仓库将作为当前pom的远程仓库。

    pluginRepositories

    • plugin插件的仓库。pluginRepositories的定义和repositories的定义类似

    activeProfiles

    底包含一系列的activeProfile元素

    相关文章

      网友评论

          本文标题:mvn-settings文件翻译

          本文链接:https://www.haomeiwen.com/subject/ecbtvftx.html