李晨光原创IT 2014-05-31
如果您在使用 OSC Maven 时是否遇到了这个问题:
[ERROR] Failed to execute goal on project ...: Could not resolve dependencies for project ...: The following artifacts could not be resolved: com.smart:smart-framework:jar:1.0, ...: Failure to find com.smart:smart-framework:jar:1.0 in http://maven.oschina.net/content/groups/public/ was cached in the local repository, resolution will not be reattempted until the update interval of osc has elapsed or updates are forced -> [Help 1]
或许本文会帮您解决这个问题。
据了解,目前 OSC Maven 已经将所有第三方 jar 包放到了独立的仓库中,该仓库的地址如下:
http://maven.oschina.net/content/repositories/thirdparty/
为了防止与中央仓库同步时导致冲突,目前 thirdparty 仓库与 public 仓库没有任何交集了,也就是说它们是完全独立的,public 不再包括 thirdparty。
所以需要在自己的 setting.xml 中做如下配置(注意绿色文字):
<mirrors>
...
<mirror>
<id>osc</id>
<mirrorOf>central</mirrorOf>
<url>http://maven.oschina.net/content/groups/public/</url>
</mirror>
<mirror>
<id>osc_thirdparty</id>
<mirrorOf>thirdparty</mirrorOf>
<url>http://maven.oschina.net/content/repositories/thirdparty/</url>
</mirror>
...
</mirrors>
<profiles>
...
<profile>
<id>osc</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>osc</id>
<url>http://maven.oschina.net/content/groups/public/</url>
</repository>
<repository>
<id>osc_thirdparty</id>
<url>http://maven.oschina.net/content/repositories/thirdparty/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>osc</id>
<url>http://maven.oschina.net/content/groups/public/</url>
</pluginRepository>
</pluginRepositories>
</profile>
...
</profiles>
欢迎使用 OSC Maven 仓库: maven.oschina.net