【发布时间】:2014-06-10 17:42:26
【问题描述】:
我正在尝试使用 maven 构建我的 java hibernate 项目。 但是当我尝试这样做时,似乎有一个依赖项不可用?
我的项目中现在有这个 pom.xml:
<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>net.viralpatel.hibernate</groupId>
<artifactId>HibernateHelloWorldXML</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>HibernateHelloWorldXML</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>ejb3-persistence</artifactId>
<version>1.0.1.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.3.1.GA</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.10</version>
</dependency>
</dependencies>
</project>
当我尝试使用 mvn 构建时,我收到此错误:
[WARNING] An error occurred during dependency resolution.
Failed to retrieve javax.transaction:jta-1.0.1B
Caused by: Failure to find javax.transaction:jta:jar:1.0.1B in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will
not be reattempted until the update interval of central has elapsed or updates are forced
Try downloading the file manually from:
http://java.sun.com/products/jta
Then, install it using the command:
mvn install:install-file -DgroupId=javax.transaction -DartifactId=jta -Dversion=1.0.1B -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=javax.transaction -DartifactId=jta -Dversion=1.0.1B -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -Drepository
Id=[id]
Path to dependency:
1) net.viralpatel.hibernate:HibernateHelloWorldXML:jar:1.0-SNAPSHOT
2) org.hibernate:hibernate-annotations:jar:3.3.1.GA
3) org.hibernate:hibernate:jar:3.2.6.ga
4) javax.transaction:jta:jar:1.0.1B
javax.transaction:jta:jar:1.0.1B
from the specified remote repositories:
central (http://repo.maven.apache.org/maven2, releases=true, snapshots=false)
我搜索了这个错误,发现很多人不得不在他们的 pom.xml 文件中更改他们的 hibernate-core 依赖版本,但似乎我没有 hibernate-core,所以我该如何解决这个问题?
【问题讨论】:
标签: java eclipse hibernate maven