如何强制Maven / Eclipse下载JAR依赖项?

时间:2015-10-13 20:42:30

标签: eclipse maven junit dependencies eclipse-mars

我在Windows 7上使用Maven 3.3.3,Java 8.我正在使用Eclipse Mars。我正在尝试通过右键单击类名在Eclipse编辑器中运行JUnit测试,选择“运行作为“ - >”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

Hoewver,当我查看我的存储库时,没有下载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 个答案:

答案 0 :(得分:0)

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

enter image description here

相关问题