2012-11-09 13 views

回答

0

最好的解決方法是使用配置在目前只測試是這樣的:

<project> 
    ... 
    <pluginRepositories> 
    <pluginRepository> 
     <id>apache.snapshots</id> 
     <url>http://repository.apache.org/snapshots/</url> 
    </pluginRepository> 
    </pluginRepositories> 
    ... 
</project> 

或適當更改您的設置是這樣的:

<settings> 
    ... 
    <profiles> 
    <profile> 
     <id>apache</id> 
     <pluginRepositories> 
     <pluginRepository> 
      <id>apache.snapshots</id> 
      <name>Maven Plugin Snapshots</name> 
      <url>http://repository.apache.org/snapshots/</url> 
      <releases> 
      <enabled>false</enabled> 
      </releases> 
      <snapshots> 
      <enabled>true</enabled> 
      </snapshots> 
     </pluginRepository> 
     </pluginRepositories> 
    </profile> 
    </profiles> 
    ... 
</settings> 
當然

與型材的激活。或者更改存儲庫管理器的配置。

3

您應該爲您的pom添加一個存儲庫,這樣構建將保持可移植性,並且構建您的代碼的其他開發人員不需要更新其settings.xml。

這應該做的工作:

<repositories> 
    <repository> 
     <id>repo-id</id> 
     <name>repo-name</name> 
     <url>https://oss.sonatype.org/content/repositories/snapshots/</url> 
    </repository> 
</repositories> 
+0

我可以juest推薦閱讀:http://www.sonatype.com/people/2009/02/why-putting-repositories-in-your-poms這是一個壞主意/在一個pom中導致一個倉庫是一個壞主意,並且相反:它會使你的構建不能移植。 – khmarbaise