2016-08-23 122 views
1

在項目的pom.xml中,它具有從遠程存儲庫下載的依賴關係。遠程存儲庫中存在依賴關係的問題

<parent> 
    <groupId>org.jenkins-ci.plugins</groupId> 
    <artifactId>plugin</artifactId> 
    <version>1.567</version> 
</parent> 

<repositories> 
    <repository> 
     <id>repo.jenkins-ci.org</id> 
     <url>http://repo.jenkins-ci.org/public/</url> 
    </repository> 
</repositories> 

我明白了什麼是Maven的本地資源庫中

  1. 搜索,如果沒有找到
  2. 搜索本地企業的關係資源庫它,如果它沒有找到
  3. 應該下載從遠程存儲庫

當我執行命令mvn test它showi納克軌跡如下

在它表明這是從本地關係庫下載

Could not find artifact org.jenkins-ci.plugins:plugin:pom:1.567 in nexus (http://localnexus/nexus/content/groups/group/) and 'parent.relativePath' points at no local POM 

誰能幫我解決了這個錯誤.. 有什麼事情關係到代理設置? ,

,因爲它是不會到遠程存儲庫鏈接..

D:\Hygieia-master\hygieia-jenkins-plugin>mvn test 

[INFO] Scanning for projects… 

Downloading: http://localnexus/nexus/content/groups/group/org/jenkins-ci/plugins/plugin/1.567/plugin-1.567.pom 

Downloading: http://repo.jenkins-ci.org/public/org/jenkins-ci/plugins/plugin/1.567/plugin-1.567.pom 

[ERROR] [ERROR] Some problems were encountered while processing the POMs: 

[FATAL] Non-resolvable parent POM for org.jenkins-ci.plugins:hygieia-publisher:1.4-SNAPSHOT: Could not find artifact org.jenkins-ci.plugins:plugin:pom:1.567 in nexus (http://localnexus/nexus/content/groups/group/) and 'parent.relativePath' points at no local POM @ line 15, column 13 
@ 

[ERROR] The build could not read 1 project -> [Help 1] 

[ERROR] 
[ERROR] The project org.jenkins-ci.plugins:hygieia-publisher:1.4-SNAPSHOT (D:\Hygieia-master\hygieia-jenkins-plugin\pom.xml) has 1 error 

[ERROR]  Non-resolvable parent POM for org.jenkins-ci.plugins:hygieia-publisher:1.4-SNAPSHOT: Could not find artifact org.jenkins-ci.plugins:plugin:pom:1.567 in nexus (http://localnexus/nexus/content/groups/group/) and 'parent.relativePath' points at no local POM @ line 15, column 13 -> [Help 2] 
[ERROR] 

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 

[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 

[ERROR] For more information about the errors and possible solutions, please read the following articles: 

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException 

[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException 

下面是我將Settings.xml

<settings> 
    <servers> 
     <server> 
      <id>nexus</id> 
      <username>user</username> 
      <password>pwd</password> 
      <configuration> 
       <httpConfiguration> 
        <all> 
         <params> 
          <param> 
           <name>http.authentication.preemptive</name> 
           <value>%b,true</value> 
          </param> 
         </params> 
        </all> 
       </httpConfiguration> 
       <httpHeaders> 
        <property> 
         <name>username</name> 
         <value>user</value> 
        </property> 
       </httpHeaders> 
      </configuration> 
     </server> 
    </servers> 

    <mirrors> 
    <mirror> 
     <!--This sends everything else to /public --> 
     <id>nexus</id> 
     <mirrorOf>central</mirrorOf> 
     <url>http://localnexus/nexus/content/groups/group/</url> 
    </mirror> 
    </mirrors> 
    <profiles> 
    <profile> 
     <id>nexus</id> 
     <!--Enable snapshots for the built in central repo to direct --> 
     <!--all requests to nexus via the mirror --> 
     <repositories> 
     <repository> 
      <id>central</id> 
      <url>http://central</url> 
      <releases><enabled>true</enabled></releases> 
      <snapshots><enabled>true</enabled></snapshots> 
     </repository> 

     </repositories> 
    <pluginRepositories> 
     <pluginRepository> 
      <id>central</id> 
      <url>http://central</url> 
      <releases><enabled>true</enabled></releases> 
      <snapshots><enabled>true</enabled></snapshots> 
     </pluginRepository> 

     </pluginRepositories> 
     <properties> 
       <archetypeCatalog>http://localnexus/nexus/content/groups/PUBLIC_REPO/</archetypeCatalog> 
     </properties> 

    </profile> 
    </profiles> 
    <activeProfiles> 
    <!--make the profile active all the time --> 
    <activeProfile>nexus</activeProfile> 
    </activeProfiles> 




</settings> 
+0

正確配置你的連接從jenkins-ci回購下載,而不是手動添加到你的pom文件中... – khmarbaise

回答

1

這是類似於此question

如果你的父POM是從遠程倉庫中取出,那麼你可以修改你的父標籤作爲

<parent> 
     <groupId>org.jenkins-ci.plugins</groupId> 
     <artifactId>plugin</artifactId> 
     <version>1.567</version> 
     <relativePath></relativePath> 
    </parent> 

添加一個空relativepath將解決父POM從存儲庫。如果不指定relativePath,則默認爲../pom.xml。

從DOC,

簽出中父pom.xml文件的相對路徑。如果未指定,則默認爲../pom.xml。 Maven先在文件系統上的這個位置查找父POM,然後在本地存儲庫中查找,最後在遠程回購庫中查找。 relativePath允許您選擇不同的位置,例如,當您的結構是平坦的,或者沒有中間父POM時更深。但是,組ID,工件ID和版本仍然是必需的,並且必須與給定位置中的文件相匹配,否則它將恢復到POM的存儲庫。此功能僅用於增強該項目的本地結帳開發。將該值設置爲空字符串,以防止要禁用該功能並始終從存儲庫中解析父POM。 默認值是:../pom.xml。

這裏請參閱doc

+1

我已經嘗試添加。但是,它仍然是一樣的。 我已經把Settings.xml放在上面。你能否建議如果上面的配置是迫使它從本地連接庫而不是遠程庫下載 – Harsha