我对自己对 Maven 的理解不是很有信心,所以请耐心等待:
我的 POM:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.transaction</artifactId>
<version>3.2.4.RELEASE</version>
</dependency>
构建:
[WARNING] The POM for org.springframework:org.springframework.transaction:jar:3.2.4.RELEASE is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.427 s
[INFO] Finished at: 2016-12-02T15:22:42-08:00
[INFO] Final Memory: 7M/77M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project PROJECT: Could not resolve dependencies for project PROJECT:jar:1.0: Failure to find org.springframework:org.springframework.transaction:jar:3.2.4.RELEASE in http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of maven2 has elapsed or updates are forced -> [Help 1]
查看http://repo1.maven.org/maven2这是有道理的。 org.springframework.transaction 确实不存在于存储库中。所以我去了this page并注意到它说该 Artifact 位于以下存储库中:
https://artifacts.alfresco.com/nexus/content/repositories/public/
这一次,在查看存储库时,我确实在与 POM 中指定的 groupId 和artifactId 匹配的目录中找到了org.springframework.transaction
。
但是这里显然没有3.2.4.RELEASE
。我的同事能够构建该项目(尽管他们已经有一段时间没有重新检查该项目了),并且他们记得遇到了类似的问题。我有点困惑为什么这感觉像是存储库问题,尽管我们都运行相同的 POM。
顺便说一句,还有多个其他 org.springframework
依赖项正在正确解析,我可以在我的 ~/.m2
中看到它们,但不是这个。
最佳答案
org.springframework.transaction 具有 spring-tx Artifact id。
我在我的 pom 中使用了这个代码片段并且可以无缝工作:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>3.2.4.RElEASE</version>
</dependency>
关于java - 无法解析依赖项: org. springframework.transaction,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40942515/