Eclipse:类路径引用的档案不存在 [英] Eclipse: The archive which is referenced by the classpath, does not exist
问题描述
我的Eclipse是Indigo Java经典版本.
My Eclipse is Indigo Java classic.
我有一个java项目,其中所有对象都具有mockito-all. pom.xml:
I have a java project which has mockito-all as a dependency. pom.xml:
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.5</version>
<scope>test</scope>
</dependency>
运行mvn clean install
,一切正常.然后,我做了mvn eclipse:eclipse
来解决Eclipse中的所有依赖关系.
run mvn clean install
, everything is ok. Then I did mvn eclipse:eclipse
to resolve all the dependencies in Eclipse.
当我尝试在Eclipse中运行Junit时,它没有运行,并给了我这个错误:
when I try to run a Junit in eclipse, it doesn't run and gives me this error:
'Launching YourTest' has encountered a problem.
The archive: /home/shengjie/.m2/repository/org/mockito/mockito-all/1.9.5.jar which is referenced by the classpath, does not exist.
我的项目pom.xml声称它取决于所有的嘲笑1.8.5,我不确定1.9.5引用来自何处.有什么想法吗?
My project pom.xml claims it's depending on mockito-all 1.8.5, I am not sure where the 1.9.5 reference is coming from. Any ideas?
== EDIT ==
==EDIT==
$ mvn dependency:tree | grep mockito
[INFO] +- org.mockito:mockito-all:jar:1.8.5:test
[INFO] \- org.powermock:powermock-api-mockito:jar:1.4.12:test
[INFO] \- org.powermock:powermock-api-mockito:jar:1.4.12:test
[INFO] +- org.mockito:mockito-all:jar:1.8.5:test (version managed from 1.9.0)
[INFO] | +- org.mockito:mockito-all:jar:1.8.5:test (version managed from 1.9.5; scope managed from compile)
[INFO] | +- org.mockito:mockito-all:jar:1.8.5:test (version managed from 1.9.5; scope managed from compile)
[INFO] \- org.powermock:powermock-api-mockito:jar:1.4.12:test
[INFO] +- org.mockito:mockito-all:jar:1.8.5:test
[INFO] +- org.powermock:powermock-api-mockito:jar:1.4.12:test
[INFO] | +- org.mockito:mockito-all:jar:1.8.5:test (version managed from 1.9.5; scope managed from compile)
推荐答案
在尝试启动雄猫时,我遇到了类似的问题.我建议您通过以下方式检查类路径":
I had a similar problem while I was trying to start my tomcat. I would suggest that you check "Classpath" the following way:
1)运行配置
- 右键单击您的项目
- 然后单击运行"->运行配置..."
- 检查项目的设置(例如,在我的情况下是Apache Tomcat)
- 在这里查看用户条目"下的类路径"标签
- Right click on your project
- then click "Run" -> "Run Configurations..."
- there check your settings for you project (e. g. in my case it was the Apache Tomcat)
- here look into you tab "Classpath" under "User Entries"
2)项目类路径
- 右键单击您的项目->属性"->"Java构建路径"
- 现在检查来源"标签以及库"标签
- 在库"标签中,问题应标记为红色
- Right click on your project -> "Properties" -> "Java Build Path"
- now check the "Source" Tab as well as your "Libraries" Tab
- Problems should be marked red in the "Libraries" tab
这篇关于Eclipse:类路径引用的档案不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!