[英]Could not resolve dependencies: org.springframework.transaction
I am not super confident in my understanding of Maven so bear with me: 我对Maven的理解并不十分自信,请耐心等待:
My POM: 我的POM:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.transaction</artifactId>
<version>3.2.4.RELEASE</version>
</dependency>
Build: 建立:
[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]
Looking in http://repo1.maven.org/maven2 this makes sense. 在http://repo1.maven.org/maven2中查找,这很有意义。
org.springframework.transaction
is indeed not present in the repository. 仓库中确实不存在
org.springframework.transaction
。 So I went to this page and noticed that it says the artifact lives in the following repository: 因此,我转到此页面并注意到它说工件存在于以下存储库中:
https://artifacts.alfresco.com/nexus/content/repositories/public/ https://artifacts.alfresco.com/nexus/content/repositories/public/
This time, looking through the repository I did find org.springframework.transaction
at the directory matching the groupId and artifactId specified in my POM. 这次,通过查看存储库,我确实在与POM中指定的groupId和artifactId相匹配的目录中找到了
org.springframework.transaction
。
https://artifacts.alfresco.com/nexus/content/repositories/public/org/springframework/org.springframework.transaction/ https://artifacts.alfresco.com/nexus/content/repositories/public/org/springframework/org.springframework.transaction/
However there is clearly no 3.2.4.RELEASE
here. 但是,这里显然没有
3.2.4.RELEASE
。 My co-worker's are able to build the project (though it has been some time since they checked it out fresh) and they remember running into a similar issue. 我的同事能够构建该项目(尽管自从他们重新检查项目以来已经有一段时间了),他们还记得遇到了类似的问题。 I am a little confused as to why this feels like a repository issue though when we are all running the same POM.
对于为什么当我们都运行相同的POM时,为什么这感觉像是存储库问题,我有些困惑。
As an aside, there are multiple other org.springframework
dependencies that are resolving appropriately and I can see them in my ~/.m2
, just not this one. org.springframework
说org.springframework
,还有其他多个org.springframework
依赖项可以正确解析,我可以在~/.m2
看到它们,而不仅仅是这个。
The org.springframework.transaction has the spring-tx artifact id. org.springframework.transaction具有spring-tx工件ID。
I use this snippet in my pom and works seamlessly: 我在pom中使用此代码段,并且可以无缝工作:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>3.2.4.RElEASE</version>
</dependency>
Your .m2 does not have it and Maven tries to get it from defined repositories. 您的.m2没有它,Maven尝试从已定义的存储库中获取它。 You do not have them or you do not have a connection from Maven.
您没有它们,或者您没有与Maven的连接。 (it is more likely from what error says as I remember).
(很可能是因为我记得错误提示)。 are you behind the proxy?
你在代理人后面吗?
You need to define additional repositories. 您需要定义其他存储库。 either in ~/.m2/settings.xml or inside POM on project level.
在〜/ .m2 / settings.xml或项目级别的POM内部。
Something like that: 像这样:
<repositories>
<repository>
<id>fuse-public-repository</id>
<name>FuseSource Community Release Repository</name>
<url>https://repo.fusesource.com/nexus/content/groups/public</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
<repositories>
in settings.xml usually in one of the active profile element. 在settings.xml中通常位于活动配置文件元素之一中。 In POM just inside project.
在项目内部的POM中。
PS. PS。 be sure you have connection to the repository URL.
确保您已连接到存储库URL。 If you are behind proxy you need to define it as well in settings.xml
如果您在代理后面,则还需要在settings.xml中对其进行定义
As @Vadim just answered, you just need to add your custom repo to your pom. 就像@Vadim回答的那样,您只需要将自定义存储库添加到pom中即可。
<repositories>
<repository>
<id>alfresco</id>
<name>your custom repo</name>
<url>http://repository.springsource.com/maven/bundles/release</url>
</repository>
</repositories>
And then you can get your dependency by using: 然后,您可以使用以下方法获取依赖项:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.transaction</artifactId>
<version>3.2.4.RELEASE</version>
</dependency>
You can view the repository contents by using this link https://artifacts.alfresco.com/nexus/#nexus-search;quick~transaction 您可以使用此链接查看存储库内容https://artifacts.alfresco.com/nexus/#nexus-search;quick~transaction
Also be carefull not to run maven with -o flag( or in offline mode ) for the first time in order to let maven to download the dependency. 同样要注意不要第一次使用-o标志(或在离线模式下)运行maven,以便让maven下载依赖项。
Ended up being an issue to having spring-context
dependency in my pom. 最终成为pom中具有
spring-context
依赖项的一个问题。 Apparently that does stuff for you? 显然,这对您有用吗? Getting rid of both
spring-tx
and org.springframework.transaction
actually allowed them to be downloaded and accessed properly. 摆脱
spring-tx
和org.springframework.transaction
实际上允许它们被正确下载和访问。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.