2012-07-23 23 views
2

我有一個由不是我們部門的存儲庫的Nexus實例提供的jar的依賴。我們不(還)要更新我們的Nexus鏡像中的其他資源庫,也無法改變我們的(共享)settings.xml,所以我說的存儲庫,以我們的POM:爲什麼我的POM的倉庫不被檢查工件?

<project xmlns="http://maven.apache.org/POM/4.0.0" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>com.company.department</groupId> 
    <artifactId>simple-sample-app</artifactId> 
    <packaging>war</packaging> 
    <version>0.1</version> 
    <name>simple-sample-app Maven Webapp</name> 
    <repositories> 
     <repository> 
      <id>other-department</id> 
      <name>other-department.company.com</name> 
      <url>http://other-department.company.com/content/repositories/releases/</url> 
      <snapshots> 
       <enabled>false</enabled> 
      </snapshots> 
     </repository> 
    </repositories> 
    ... 
</project> 

不過:在MVN構建是失敗的<id>other-department</id>存儲庫未被檢查。什麼沒有被正確設置?

編輯:這是我的settings.xml

<settings> 
    <offline>false</offline> 
    <proxies> 
     <proxy> 
      <active>false</active> 
      <host>internal-proxy.company.com</host> 
      <port>8080</port> 
      <nonProxyHosts>company.com</nonProxyHosts> 
     </proxy> 
    </proxies> 
    <servers> 
     <server> 
      <id>releases</id> 
      <username>deployment</username> 
      <password>deploy</password> 
     </server> 
     <server> 
      <id>snapshots</id> 
      <username>deployment</username> 
      <password>deploy</password> 
     </server> 
     <server> 
      <id>site</id> 
      <username>sitemanager</username> 
      <password>sitemanager</password> 
     </server> 
    </servers> 
    <mirrors> 
     <mirror> 
      <id>department-nexus-public-snapshots</id> 
      <url>http://nexus.department.company.com/nexus/content/groups/public-snapshots</url> 
      <mirrorOf>public-snapshots</mirrorOf> 
     </mirror> 
     <mirror> 
      <id>department-nexus-public</id> 
      <url>http://nexus.department.company.com/nexus/content/groups/public</url> 
      <mirrorOf>external:*</mirrorOf> 
     </mirror> 
    </mirrors> 

    <profiles> 
     <profile> 
      <id>development</id> 
      <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> 
     </profile> 

     <profile> 
      <id>public-snapshots</id> 
      <repositories> 
       <repository> 
        <id>public-snapshots</id> 
        <url>http://public-snapshots</url> 
        <releases> 
         <enabled>true</enabled> 
        </releases> 
        <snapshots> 
         <enabled>true</enabled> 
        </snapshots> 
       </repository> 
      </repositories> 
      <pluginRepositories> 
       <pluginRepository> 
        <id>public-snapshots</id> 
        <url>http://public-snapshots</url> 
        <releases> 
         <enabled>false</enabled> 
        </releases> 
        <snapshots> 
         <enabled>true</enabled> 
        </snapshots> 
       </pluginRepository> 
      </pluginRepositories> 
     </profile> 
    </profiles> 

    <activeProfiles> 
     <activeProfile>development</activeProfile> 
     <activeProfile>public-snapshots</activeProfile> 
    </activeProfiles> 
</settings> 
+0

你的設置如何?使用鏡像條目? – khmarbaise 2012-07-23 13:34:59

+0

@khmarbaise是的,它似乎我使用鏡像條目...我已經將我的settings.xml添加到問題。 – 2012-07-23 16:21:35

回答

1

與感謝斯特凡H和@khmarbaise。 問題出在鏡像條目中。

我的舊的settings.xml有這些鏡子條目:

<settings> 
    ... 
    <mirrors> 
    <mirror> 
     <id>department-nexus-public-snapshots</id> 
     <url>http://nexus.department.company.com/nexus/content/groups/public-snapshots</url> 
     <mirrorOf>public-snapshots</mirrorOf> 
    </mirror> 
    <mirror> 
     <id>department-nexus-public</id> 
     <url>http://nexus.department.company.com/nexus/content/groups/public</url> 
     <mirrorOf>external:*</mirrorOf> 
    </mirror> 
    </mirrors> 
    ... 
</settings> 

的問題是,<mirrorOf>external:*</mirrorOf>被踢,並有效地阻止了POM的回購。這裏的修復:

<settings> 
    ... 
    <mirrors> 
    <mirror> 
     <id>department-nexus-public-snapshots</id> 
     <url>http://nexus.department.company.com/nexus/content/groups/public-snapshots</url> 
     <mirrorOf>public-snapshots</mirrorOf> 
    </mirror> 
    <mirror> 
     <id>department-nexus-public</id> 
     <url>http://nexus.department.company.com/nexus/content/groups/public</url> 
     <mirrorOf>external:*,!other-department</mirrorOf> 
    </mirror> 
    </mirrors> 
    ... 
</settings> 

現在只能一切我們department-nexus-public項不應用於:other-department(在從POM回購的ID),可得檢查。

現在我的POM的回購正在檢查工件。

相關問題