gpt4 book ai didi

java - 解析依赖项时出现 Maven 错误

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:46:08 26 4
gpt4 key购买 nike

我是 Maven 的新手,正在尝试设置我的第一个 POM秒。我的应用程序将使用 EhCache 进行缓存。转到 Maven Central Repo(链接 here)我复制粘贴了 <dependency>标记并将其复制到我的 pom.xml像这样:

...many dependencies above this point
<dependency>
<scope>compile</scope>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.0.1.Final</version>
</dependency>
<dependency>
<scope>compile</scope>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<scope>compile</scope>
<groupId>jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>3.5.3</version>
</dependency>
...many dependencies below this point

当我保存更改时,Eclipse 构建工作区并在打开时给我一个错误 <dependency> EhCache 2.5 的标签:

Missing artifact net.sf.ehcache:ehcache:jar:2.5.0

所以我认为 v.2.5.0 可能有问题,并对 2.4.7 重复了同样的操作(2.4.x 之前的最后一个 2.5.0 版本)。同样的交易。

由于我是 Maven 的新手,我什至不知道从哪里开始寻找。我试过 Project >> Clean甚至重新启动 Eclipse 以查看它是否只是一个典型的 Eclipse“怪癖”。不。

我在想:

  • EhCache 会不会将错误的 JAR 发布到 Maven 存储库?
  • Maven Repo 会不会有问题?
  • 这可能是由于我的 pom.xml 中的其他配置错误造成的吗? ?
  • 这会不会是一个“JAR hell”问题,我的依赖关系图中某处存在冲突?

SO 如何着手解决这个问题?提前致谢!

最佳答案

引用search.maven.org通常更安全.那里的依赖:

<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>2.5.0</version>
<type>pom</type>
</dependency>

心型pom.来自模块的 pom:

This is a pom artifact to pull in ehcache-core and ehcache-terracotta for clustering. Make sure to set 'type' to 'pom' in your dependency.

显然,当有人不需要 terracotta 时,ehcache-core 会像其他答案状态一样完美。

关于java - 解析依赖项时出现 Maven 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8954093/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com