【发布时间】:2016-01-11 18:27:07
【问题描述】:
我在 Windows 7 上使用 Maven 3.3.3、Java 8。我正在使用 Eclipse Mars。我正在尝试在我的 Eclipse 编辑器中运行 JUnit 测试,方法是右键单击类名,选择“运行” As" -> "JUnit Test",我得到了这个错误
The archive: C:/Users/myuser/.m2/repository/commons-fileupload/commons-fileupload/1.2/commons-fileupload-1.2.jar which is referenced by the classpath, does not exist.
我的项目的 pom.xml 文件中有这个依赖项
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.2</version>
</dependency>
奇怪的是,如果我直接从命令行运行测试(在 Cygwin 上使用 bash shell),测试运行...
$ mvn clean test -Dtest=MyControllerIT
但是,当我查看我的存储库时,没有下载 JAR 文件。它只有
$ ls /cygdrive/c//Users/myuser/.m2/repository/commons-fileupload/commons-fileupload/1.2/
_remote.repositories commons-fileupload-1.2.pom.lastUpdated
commons-fileupload-1.2.pom commons-fileupload-1.2.pom.sha1
我如何强制下载这些 JAR,或者至少,我如何让 Eclipse 不再抱怨,不再像孩子一样?
【问题讨论】:
-
按照我认为它会解决您的问题的可能性的顺序(也许所有这些都是必需的): 1. 在 Eclipse 中更新 Maven 项目 2. 在命令行上使用
-U运行 Maven选项。 3. 删除您的 m2 存储库并再次运行 2 然后 1,4. 格式化您的驱动器并回家。
标签: eclipse maven junit dependencies eclipse-mars