1. 程式人生 > >ubuntu18.04下eclipse修改maven源為阿里源

ubuntu18.04下eclipse修改maven源為阿里源

下載安裝Java和Eclipse:https://www.cnblogs.com/zifeiy/p/9030111.html

然後命令列安裝Maven(不是必須的):

sudo apt-get install maven -y

然後編輯一個檔案/home/zifeiy/.m2/settings.xml

<?xml version="1.0" encoding="UTF-8"?>

<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>
    /home/zifeiy/.m2/repository
  </localRepository>

  <pluginGroups>
  </pluginGroups>

  <proxies>
  </proxies>

  <servers>
  </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>

  <profiles>
  </profiles>

</settings>

其中的mirror座標對應阿里雲的Maven映象源。

然後在Eclipse中:
window --> Preferences --> Maven --> User Settings裡面,
配置User Settings為settings.xml檔案。
然後Eclipse會更新一下。

好了之後我們可以新增幾個沒有下在國的座標看看速度,用於測試的座標:

        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.10-FINAL</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.10-FINAL</version>
        </dependency>

發現速度是真的快啊!!!