Dave
Dave

Reputation: 19290

How do I force Maven/Eclipse to download a JAR dependency?

I'm using Maven 3.3.3, Java 8 on Windows 7. I"m using Eclipse Mars. I'm trying to run a JUnit test in my Eclipse editor by right clicking on the class name, selecting, "Run As" -> "JUnit Test", and I'm getting this error

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.

I have this dependency in my project's pom.xml file

            <dependency>
                    <groupId>commons-fileupload</groupId>
                    <artifactId>commons-fileupload</artifactId>
                    <version>1.2.2</version>
            </dependency>

What is odd is that if I run the test directly from the command line (using bash shell on Cygwin), the test runs ...

$ mvn clean test -Dtest=MyControllerIT

Hoewver, when I look in my repository, there is no JAR file downloaded. All it has is

$ 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

How do I force the downloads of these JARs, or at least, how do I get Eclipse to stop complaining and being such a baby?

Upvotes: 2

Views: 2136

Answers (1)

Deb
Deb

Reputation: 663

After updating the POM.xml file, all you have to do is, right click and refresh the Maven Dependencies.

enter image description here

Upvotes: 0

Related Questions