2015-10-13 132 views
2

我在Windows 7上使用Maven 3.3.3,Java 8我使用Eclipse Mars我试图在Eclipse编辑器中运行JUnit测试,方法是右键单击类名,然后选择“Run As “ - >‘JUnit测试’,而我得到这个错误如何强制Maven/Eclipse下载JAR依赖项?

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来停止抱怨和是这样一个孩子吗?

+0

通过的我怎么可能认为这将解决您的问题单(也许所有的人都需要) :1.更新Eclipse中的Maven项目2.使用'-U'选项在命令行上运行Maven。 3.删除你的M2回购,然后再运行2和1,4.格式化你的驱动器并回家。 – Tunaki

回答

0

删除文件: C:/Users/myuser/.m2/repository/commons-fileupload/commons-fileupload

+0

这不起作用。我删除了该目录,在Eclipse中再次运行测试,并得到相同的错误。你只是疯狂猜测,对吧? – Dave

相关问题