2012-10-24 37 views
-2

我试图休眠注释添加到我的Maven的项目,但我有这个以下错误:拒绝访问http://repository.jboss.com/maven2/

  • ArtifactDescriptorException: Failed to read artifact descriptor for hibernate-commons-annotations:hibernate-commons-annotations:jar:3.0.0.GA: ArtifactResolutionException: Failure to transfer hibernate-commons-annotations:hibernate-commons-annotations:pom:3.0.0.GA from http:// repository.jboss.com/maven2/ was cached in the local repository, resolution will >not be reattempted until the update interval of JBoss repository has elapsed or updates are forced. Original error: Could not transfer artifact hibernate->commons-annotations:hibernate-commons-annotations:pom:3.0.0.GA from/to JBoss repository (http://repository.jboss.com/maven2/): Access denied to >http://repository.jboss.com/maven2/hibernate-commons-annotations/hibernate- commons-annotations/3.0.0.GA/hibernate-commons-annotations-3.0.0.GA.pom. Error >code 403, Forbidden
    • ArtifactDescriptorException: Failed to read artifact descriptor for hibernate->annotations:hibernate-annotations:jar:3.3.0.GA: ArtifactResolutionException: Failure to transfer hibernate-annotations:hibernate->annotations:pom:3.3.0.GA from http://repository.jboss.com/maven2/ was cached in the local repository, resolution will not be reattempted until the >update interval of JBoss repository has elapsed or updates are forced. Original error: Could not transfer artifact hibernate-annotations:hibernate->annotations:pom:3.3.0.GA from/to JBoss repository (http://repository.jboss.com/ maven2/): Access denied to http://repository.jboss.com/maven2/hibernate- >annotations/hibernate-annotations/3.3.0.GA/hibernate- annotations-3.3.0.GA.pom. Error code 403, Forbidden

我使用此代码

<repository> 
    <id>JBoss repository</id> 
    <url>http://repository.jboss.com/maven2/</url> 
</repository> 

<!-- Hibernate annotation --> 
<dependency> 
    <groupId>hibernate-annotations</groupId> 
    <artifactId>hibernate-annotations</artifactId> 
    <version>3.3.0.GA</version> 
</dependency> 

<dependency> 
    <groupId>hibernate-commons-annotations</groupId> 
    <artifactId>hibernate-commons-annotations</artifactId> 
    <version>3.0.0.GA</version> 
</dependency> 

回答

6

按照JBoss Maven Repositories的描述中, http://repository.jboss.com/maven2/已弃用,应该由http://repository.jboss.org/nexus/content/groups/public/代替。

你可以阅读开发者应该如何configure Maven to use the JBoss Repository

因此,在您使用POM:

<repositories> 
    <repository> 
    <id>jboss-public-repository-group</id> 
    <name>JBoss Public Repository Group</name> 
    <url>http://repository.jboss.org/nexus/content/groups/public/</url> 
    </repository> 
</repositories> 

对于hibernate-annotations:hibernate-annotations:3.3.0.GA依赖,使用Maven的中央仓库也无济于事,因为 它不是由它主持。但它由JBoss Repository托管在JBoss已弃用
但是,您会在Maven中心找到它(重命名为)org.hibernate:hibernate-annotations:3.3.0.ga

如果你真的想使用已弃用的仓库:

<repositories> 
    <repository> 
    <id>jboss-deprecated</id> 
    <name>JBoss Deprecated</name> 
    <url>https://repository.jboss.org/nexus/content/repositories/deprecated/</url> 
    </repository> 
</repositories> 

不同的JBoss Maven资源库/组解释there

参见:

关于JBoss的,过时的组id(如hibernate-annotations)公布there