运行mvn clean install
时收到以下错误。
错误提示无法解析依赖性javax.transaction:jta:jar:1.0.1B
请注意,我在pom中没有引用javax.transaction:jta:jar:1.0.1B
。可能是我在pom中提到的其他依赖项引用了此依赖项。
请在下面找到错误
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building sample-webapp Maven Webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: https://repo.maven.apache.org/maven2/javax/transaction/jta/1.0.1B/jta-1.0.1B.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.810 s
[INFO] Finished at: 2016-12-05T08:43:47+05:30
[INFO] Final Memory: 12M/309M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project sample-webapp: Could not resolve dependencies for project com.ganesh:sample-webapp:war:1.0-SNAPSHOT: Could not find artifact ja
vax.transaction:jta:jar:1.0.1B in central (https://repo.maven.apache.org/maven2), try downloading from http://java.sun.com/products/jta -> [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
最佳答案
这是Maven Central无法提供的旧版库。
它不可用,因为仍有一些旧的Sun时代Javax JARS未包含在开放源代码许可证中。如果需要访问此JTA 1.0.1B库,则需要使用排除项替换该依赖项。
注意:当我在浏览器中点击此URL https://repo.maven.apache.org/maven2/javax/transaction/jta/1.0.1B/jta-1.0.1B.jar时,它返回到404 Not Found,那么我不知道为什么可以下载它。
有关更多信息,Why can't I download the javax.transaction:jta:1.0.1B JAR?