Maven setting 配置

  • setting.xml
<?xml version="1.0" encoding="UTF-8"?>
<settings
  xsi:schemaLocation="https://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"
  xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <!-- 本地仓库地址 -->
  <localRepository>/Users/ming/maven-repo</localRepository>

  <pluginGroups>
  	<!-- sonarqube -->
	  <pluginGroup>org.sonarsource.scanner.maven</pluginGroup>
  </pluginGroups>
  
  <!-- 镜像地址  mirrorOf * 是指所有central,local,remote都用这个-->
  <mirrors>
    <mirror>
      <id>central</id>
      <mirrorOf>*</mirrorOf>
      <name>releases</name>
      <url>https://maven.aliyun.com/repository/public</url>
    </mirror>
    <mirror>
      <id>snapshots</id>
      <mirrorOf>*</mirrorOf>
      <name>snapshots</name>
      <url>https://maven.aliyun.com/repository/snapshots</url>
    </mirror>
    <mirror>
      <id>jcenter</id>
      <mirrorOf>*</mirrorOf>
      <name>jcenter</name>
      <url>http://mirrors.163.com/maven/repository/maven-central</url>
    </mirror>
  </mirrors> 

  <!-- 仓库配置 -->
  <profiles>
    <profile>
      <id>ali-repo</id>
      <repositories>
        <repository>
          <snapshots />
          <releases>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
          </releases>
          <id>central</id>
          <url>https://maven.aliyun.com/repository/public</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>plugins-releases</id>
          <name>plugins-releases</name>
          <url>https://maven.aliyun.com/repository/public</url>
        </pluginRepository>
        <pluginRepository>
          <snapshots />
          <id>plugins-snapshots</id>
          <name>plugins-snapshots</name>
          <url>https://maven.aliyun.com/repository/snapshots</url>
        </pluginRepository>
      </pluginRepositories>
    </profile>

    <profile>
      <id>jcenter</id>
      <repositories>
        <repository>
          <snapshots />
          <releases>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
          </releases>
          <id>jcenter</id>
          <url>http://mirrors.163.com/maven/repository/maven-central</url>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <snapshots>
            <enabled>false</enabled>
          </snapshots>
          <id>jcenter-releases</id>
          <name>plugins-releases</name>
          <url>http://mirrors.163.com/maven/repository/maven-central</url>
        </pluginRepository>
        <pluginRepository>
          <snapshots />
          <id>jcenter-snapshots</id>
          <name>plugins-snapshots</name>
          <url>http://mirrors.163.com/maven/repository/maven-central</url>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>

  <!-- http://jcenter.bintray.com/ -->
  <!-- 激活配置 -->
  <activeProfiles>
    <activeProfile>aliRepository</activeProfile>
    <!-- <activeProfile>jcenter</activeProfile> -->
  </activeProfiles>

</settings>
posted @ 2024-07-11 14:38  itwetouch  阅读(5)  评论(0编辑  收藏  举报