[英]Can not find UserTransaction interface in javax.transaction package
[英]Failure to find javax.transaction:jta: in maven
我剛剛使用maven -3.2.3創建了web應用程序,然后在pom.xml中只有一些依賴項,然后右鍵單擊我的pom.xml - > RunAs - > maven install.All jars下載。然后嘗試build(比如我的pom.xml - > RunAs - > maven build)我有一個彈出設置目標。 我只是將目標字段鍵入“包” - >運行。 我面臨下面的問題
Downloaded: http://repo.maven.apache.org/maven2/org/springframework/spring/2.5.6/spring-2.5.6.jar (2881 KB at 3.3 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15:26.448s
[INFO] Finished at: Wed Oct 29 08:33:31 IST 2014
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project SpringMVCMaven: Could not resolve dependencies for project com.rajendra.spring:SpringMVCMaven:war:1.0: 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 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
以下是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>com.rajendra.spring</groupId>
<artifactId>SpringMVCMaven</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<name>SpringMVCMaven Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>2.5.6</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.2.3.ga</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
<version>2.7.7</version>
</dependency>
</dependencies>
<build>
<finalName>SpringMVCMaven</finalName>
</build>
</project>
你能告訴我哪里出了問題。 感謝您的幫助
你遇到了問題,因為你使用的是相對較舊的框架。 它們依賴於由於許可限制而無法在公共存儲庫中提供的JTA版本。 在那個時代,我們不得不從Sun下載(在同意許可后)並在我們自己的本地存儲庫中安裝了許多這樣的工件。
值得慶幸的是,在您的情況下,您只需要添加:
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
</dependency>
到你的pom.xml,它應該覆蓋舊版本。
這是一個較新的版本,但它只包含API類(不是實現),我相信它是向后兼容的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.