Java Maven 缺少依赖项 jta-1.0.1b
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23285831/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
maven missing dependency jta-1.0.1b
提问by Kaj
I'm trying to build my java hibernate project with maven. But when I try to do this, it looks like there is a dependency not available?
我正在尝试使用 maven 构建我的 java hibernate 项目。但是当我尝试这样做时,似乎没有可用的依赖项?
I have this pom.xml now in my project:
我的项目中现在有这个 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>
When I try to build using mvn then I get this error:
当我尝试使用 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)
I searched for this error and found a lot of people that had to change their hibernate-core dependency version in their pom.xml file but it seems like I don't have a hibernate-core, so how can I solve this?
我搜索了这个错误,发现很多人不得不在他们的 pom.xml 文件中更改他们的 hibernate-core 依赖版本,但似乎我没有 hibernate-core,那么我该如何解决这个问题?
采纳答案by Shashi
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.3.2.ga</version>
</dependency>
it has a recommended dependency for JTA 1.1.
它具有 JTA 1.1 的推荐依赖项。
OR
或者
You can add "http://download.java.net/maven/2" as new repository in pom.xml or settings.xml
您可以在 pom.xml 或 settings.xml 中添加“ http://download.java.net/maven/2”作为新存储库
<repository>
<id>java.net.m2repo</id>
<name>java.net Maven 2 Repository</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
For any JEE library provided by Sun or oracle .. Add below repository
对于 Sun 或 oracle 提供的任何 JEE 库.. 添加以下存储库
<repositories>
<repository>
<id>GlassFish</id>
<name>GlassFish Maven Repository</name>
<url>http://download.java.net/maven/glassfish/</url>
</repository>
<repository>
<id>java.net.m1repo</id>
<name>java.net Maven 1 Repository</name>
<url>http://download.java.net/maven/1/</url>
<layout>legacy</layout>
</repository>
<repository>
<id>java.net.m2repo</id>
<name>java.net Maven 2 Repository</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
</repositories>
回答by street hawk
I have the same problem and I have downloaded the jta-1.0.1B.jar file manually from http://www.java2s.com/Code/Jar/j/Downloadjta101Bjar.htm
我有同样的问题,我已经从http://www.java2s.com/Code/Jar/j/Downloadjta101Bjar.htm手动下载了 jta-1.0.1B.jar 文件
Im using Netbeans7.3. I expanded dependencies folder in the project and found the jta-1.0.1B.jar with small yellow icon(meant for error). Then I right click and use the option "Manually install artifact" and point to the location of the file jta-1.0.1B.jar. Solved.
我使用 Netbeans7.3。我在项目中展开了依赖文件夹,找到了带有黄色小图标的 jta-1.0.1B.jar(表示错误)。然后我右键单击并使用“手动安装工件”选项并指向文件 jta-1.0.1B.jar 的位置。解决了。
回答by Raj
Please add below repo in pom.xml -
请在 pom.xml 中添加以下 repo -
<repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/
</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
回答by Nirmalya Kar
Step:1 I have the same problem and I have downloaded the jta-1.0.1B.jar file manually from http://www.java2s.com/Code/Jar/j/Downloadjta101Bjar.htmand kept it in F drive.
步骤:1 我遇到了同样的问题,我已经从http://www.java2s.com/Code/Jar/j/Downloadjta101Bjar.htm手动下载了 jta-1.0.1B.jar 文件并将其保存在 F 驱动器中。
Step:2 Ran the below command mvn install:install-file -Dfile=F:\jta-1.0.1B.jar -DgroupId=javax.transaction -DartifactId=jta -Dversion=1.0.1B -Dpackaging=jar
步骤:2 运行以下命令 mvn install:install-file -Dfile=F:\jta-1.0.1B.jar -DgroupId=javax.transaction -DartifactId=jta -Dversion=1.0.1B -Dpackaging=jar
回答by Hrishikesh Karambelkar
You can download this jar from http://www.java2s.com/Code/Jar/j/Downloadjta101bjar.htmand install it in your local maven with following command:
您可以从http://www.java2s.com/Code/Jar/j/Downloadjta101bjar.htm下载这个 jar并使用以下命令将其安装在您的本地 maven 中:
mvn install:install-file -DgroupId=javax.transaction -DartifactId=jta -Dversion=1.0.1B -Dpackaging=jar -Dfile=jta-1.0.1b.jar
mvn install:install-file -DgroupId=javax.transaction -DartifactId=jta -Dversion=1.0.1B -Dpackaging=jar -Dfile=jta-1.0.1b.jar