ben*_*rre 16 java maven-2 hibernate
我将JBoss Maven repo添加到我的pom.xml文件中,就像这样......
<repositories>
<repository>
<id>jboss</id>
<url>http://repository.jboss.org/maven2/</url>
</repository>
</repositories>
Run Code Online (Sandbox Code Playgroud)
我这样添加了Hibernate本身......
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.5.1-Final</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
但是当我尝试构建我的应用程序时,我看到了这个错误....
Downloading: http://repository.jboss.org/maven2//org/hibernate/hibernate/3.5.1-Final/hibernate-3.5.1-Final.jar
[INFO] Unable to find resource 'org.hibernate:hibernate:jar:3.5.1-Final' in repository jboss (http://repository.jboss.org/maven2/)
Downloading: http://repo1.maven.org/maven2/org/hibernate/hibernate/3.5.1-Final/hibernate-3.5.1-Final.jar
[INFO] Unable to find resource 'org.hibernate:hibernate:jar:3.5.1-Final' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
Missing:
----------
1) org.hibernate:hibernate:jar:3.5.1-Final
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.hibernate -DartifactId=hibernate -Dversion=3.5.1-Final -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.hibernate -DartifactId=hibernate -Dversion=3.5.1-Final -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) stakeholdersupdate:stakeholdersupdate:war:1.0
2) org.hibernate:hibernate:jar:3.5.1-Final
----------
1 required artifact is missing.
Run Code Online (Sandbox Code Playgroud)
Pas*_*ent 21
正如seanizer所提到的,org.hibernate:hibernate:pom:3.5.1-Final
工件是类型的聚合模块pom
(它聚合了Hibernate Core模块).所以你确实可以通过指定一个来依赖它<type>pom</type>
.但我个人会声明对所需模块的依赖,例如Hibernate Entity Manager:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.5.1-Final</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
或者对于Hibernate Core:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.5.1-Final</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
Sea*_*oyd 10
hibernate工件的类型为pom(意味着它只是其他项目的包装器).做这个:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.5.1-Final</version>
<type>pom</type>
</dependency>
Run Code Online (Sandbox Code Playgroud)
(如果省略类型,maven将尝试将工件解析为jar,在这种情况下不存在)
归档时间: |
|
查看次数: |
46263 次 |
最近记录: |