[英]Maven error when resolving dependency
我是Maven的新手,我正試圖建立我的第一個POM
。 我的應用程序將使用EhCache進行緩存。 轉到Maven Central Repo(鏈接在這里 )我復制粘貼<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構建工作區並在EhCache 2.5的開始<dependency>
標記上給出錯誤:
缺少工件net.sf.ehcache:ehcache:jar:2.5.0
所以我認為也許v.2.5.0有一些問題,並且重復了相同的2.4.7
( 2.5.0
之前的最后2.4.x
版本)。 同樣的交易。
因為我對Maven這么新,所以我甚至不知道從哪里開始尋找。 我嘗試了Project >> Clean
,甚至重新啟動了Eclipse,看它是否只是一個典型的Eclipse“怪癖”。 不。
我在想:
pom.xml
其他配置錯誤了嗎? SO將如何開始解決這個問題? 提前致謝!
引用search.maven.org通常更安全。 從那里依賴:
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>2.5.0</version>
<type>pom</type>
</dependency>
心靈型pom。 從模塊的pom:
這是一個用於集群的ehcache-core和ehcache-terracotta的pom工件。 確保在依賴項中將“type”設置為“pom”。
顯然,當有人不需要兵馬俑時,ehcache-core會像其他答案狀態一樣完美。
他們在官方文檔中使用ehcache-core
。 Maven Central沒有 ehcache
2.5 的jar工件 ,它解釋了你的錯誤信息。
使用ehcache-core
將依賴項更改為:
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>2.5.0</version>
</dependency>
哪個成功下載到我的機器上( ehcache
沒有)。
我把它放到了IntelliJ中,它找到了它。 我懷疑你的設置有問題。 嘗試創建一個只包含此依賴項的項目。 如果無法下載,我會檢查您的設置。 例如.m2/settings.xml
您使用的是Nexus服務器還是maven代理/緩存?
BTW:搜索JAR的一種更簡單的方法是使用http://mvnrepository.com/ ,它將找到所有可用的版本並顯示您需要添加的XML。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.