2

我在 Windows 7 上使用 Maven 3.3.3、Java 8。我正在使用 Eclipse Mars。我试图在我的 Eclipse 编辑器中运行 JUnit 测试,方法是右键单击类名,选择“运行方式”- > “JUnit 测试”,我收到此错误

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 不再抱怨,不再像婴儿一样?

4

1 回答 1

0

更新 POM.xml 文件后,您所要做的就是右键单击并刷新 Maven 依赖项。

在此处输入图像描述

于 2021-01-14T01:35:03.780 回答