close

O.S. WIN 8

Eclipse: luna

Maven : 3.3.3

Maven repository主要分為下列

1.本地(Local)
預設是存在${USER}.m2/repository內,當然可以修改下載的路徑可去%M2_HOME%\conf中的setting.xml去進行修改

2.中央倉庫(central)
此次遇到的問題即是新增一個套件,因本地端無該套件而連到中央的repository,卻發現連到的是SSL而無該憑證所造成無法下載該套件的問題 console跑出的問題如下所示:

[ERROR] Failed to execute goal on project TSS: Could not resolve dependencies for project com.example:TSS:war:3.1.1: Failed to collect dependencies at org.mybatis:mybatis-spring:jar:1.2.3: Failed to read artifact descriptor for org.mybatis:mybatis-spring:jar:1.2.3: Could not transfer artifact org.mybatis:mybatis-spring:pom:1.2.3 from/to central (**https://repo.maven.apache.org/maven2**): sun.security.validator.ValidatorException:** PKIX path building failed**: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target ->

此時除了可以透過jdk本身java tool更新本地端的憑證外,另外也可以透過下列遠端方式去下載該套件

SSL憑證問題可參照 http://lab.howie.tw/2012/12/howto-resolve-self-sign-certificate-https-connection.html

3.遠端(remote)

遠端URL的可設定在pom.xml內

<repositories>
    <repository>
      <id>central</id>
      <url>http://repo1.maven.org/maven2</url>
      <releases>
        <enabled>true</enabled>
      </releases>
    </repository>
  </repositories>

下載相關套件的判斷順序為本地 > 中央 > 遠端

詳請參考下列網址 http://wiki.jikexueyuan.com/project/maven/repositories.html

另外若是有遇到公司或學校proxy的問題(connection time out)也需要去%M2_HOME%\conf中的setting.xml去進行修改

proxy的位置:IE瀏覽器 > 工具 > 網際網路選項 > 連線 > 區域網路設定 > Proxy伺服器

何謂proxy? 請參照下列網址 http://linux.vbird.org/linux_server/0420squid.php

maven proxy的問題可參照下列網址 http://ccckmit.wikidot.com/cr:maven

<proxy>
  <id>optional</id>
  <active>true</active>
  <protocol>http</protocol>
  <username></username>
  <password></password>
  <host>xxx.xxx.corp</host>
  <port>80</port>
  <nonProxyHosts></nonProxyHosts>
</proxy>
arrow
arrow
    文章標籤
    repository proxy
    全站熱搜

    Codeless 發表在 痞客邦 留言(0) 人氣()