2013-03-29 62 views
1

的項目我的POM文件有以下分配管理標籤的Maven找不到依賴於的Nexus

<distributionManagement> 
    <repository> 
     <id>confiz-repo</id> 
     <url>http://10.10.10.230:8081/nexus/content/repositories/snapshots/</url> 
     <releases> 
      <enabled>true</enabled> 
     </releases> 
     <snapshots> 
      <enabled>true</enabled> 
      <updatePolicy>always</updatePolicy> 
     </snapshots> 
    </repository> 
</distributionManagement> 

我用MVN部署,並且給了我成功了。所以我知道我的神器已經部署成功。現在我的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"> 
    <pluginGroups> 
    </pluginGroups> 

    <proxies> 
    </proxies> 

    <servers> 
    <server> 
     <id>confiz-repo</id> 
     <username>admin</username> 
     <password>admin123</password> 
    </server> 
    </servers> 

    <mirrors> 
    <mirror> 
     <!-- The id of this mirror and the server instance above needs to be the same!--> 
     <id>confiz-repo</id> 
     <mirrorOf>*</mirrorOf> 
     <url> http://10.10.10.230:8081/nexus/content/groups/public/</url> 
    </mirror> 
    <mirror> 
     <!-- The id of this mirror and the server instance above needs to be the same!--> 
     <id>confiz-repo</id> 
     <mirrorOf>*</mirrorOf> 
     <url> http://10.10.10.230:8081/nexus/content/repositories/snapshots/</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>confiz-repo</id> 
      <url>http://central</url> 
      <releases> 
     <enabled>true</enabled> 
     </releases> 
      <snapshots> 
     <enabled>true</enabled> 
     <updatePolicy>always</updatePolicy> 
     </snapshots> 
     </repository> 
     </repositories> 
     <pluginRepositories> 
     <pluginRepository> 
      <id>confiz-repo</id> 
      <url>http://central</url> 
      <releases> 
     <enabled>true</enabled> 
     </releases> 
      <snapshots> 
     <enabled>true</enabled> 
     </snapshots> 
     </pluginRepository> 
     </pluginRepositories> 
    </profile> 
    </profiles> 


    <activeProfiles> 
    <activeProfile>nexus</activeProfile> 
    </activeProfiles> 

</settings> 

現在,當我加入的第一個項目的依賴關係到我的第二個項目,運行mvn乾淨安裝Maven抱怨

[ERROR] Failed to execute goal on project merchant: Could not resolve dependencies for project com.onestopspot:merchant:apk:1.0.1-SNAPSHOT: Could not find artifact com.confiz.abc:my-artifact:jar:1.0-SNAPSHOT in confiz-repo (http://10.10.10.230:8081/nexus/content/groups/public/) -> [Help 1] 

我到底做錯了什麼?

編輯 - 我可以看到我的工件部署在nexus中。所以我正確地說mvn部署工作正常。但是nexus嘗試讀取的路徑http://10.10.10.230:8081/nexus/content/groups/public/不包含我的工件。

+0

只是一個猜測:嘗試第一次:清理安裝在必須部署的項目上。其次(安裝後),部署它 – dantuch

+0

「所以我知道我的神器已經部署成功」 - 不,你不知道。使用瀏覽器轉到Nexus並在http://10.10.10.230:8081/nexus/content/repositories/snapshots/下查找您的工件 - 如果它不在那裏,您知道您沒有真正獲得成功的部署,所以你需要在Maven輸出的時候用Maven的輸出來更新你的問題。 – parsifal

+0

如果你在那裏看到你的groups/public存儲庫是錯誤配置的。不過,它應該引用你的快照庫,所以我敢打賭你沒有正確部署。 – parsifal

回答

0

你的第二個項目是試圖抓住從關係的第一個項目的神器這是不存在的有

  1. 你可能想在Nexus
  2. 部署快照如果你不想做1。在離線模式下運行mvn clean install -o第二個項目
+0

一些存儲庫會用快照做'奇怪'的事情......也許他的回購deos不允許快照,或者在部署完成後清除它們......他應該嘗試完整版IMO。 – dantuch

+0

我的settings.xml文件是否有效?我認爲我的發行版管理指向一個回購,而settings.xml文件嘗試讀取到另一個回購 – user1730789

+0

,如果它在http://10.10.10.230:8081/nexus/content/repositories/snapshots中可用,那麼它會是可用的 –