clarson
clarson

Reputation: 566

Maven will only download a pom, it won't download the jar

I am new to maven and I am having what I'm sure is a config issue. I have my master pom and a child jar pom. Inside the jar pom I declared this dependency:

<dependency>  
  <groupId>commons-lang</groupId>  
  <artifactId>commons-lang</artifactId>  
  <version>2.4</version>  
</dependency>

However, when I look in my $HOME/.m2/repository dir, only the pom file is there. There is no jar file. Most of the other dependencies have jar files, but not this one. Without this jar, the compile step is failing.

Any ideas about what I am doing wrong?

Upvotes: 5

Views: 11882

Answers (4)

Gleb Konstantinov
Gleb Konstantinov

Reputation: 1

Had same problem. In my case I have defined scope of dependency test, but didn't execute maven test goal. Maven will download jar if scope goal was executed.

Upvotes: 0

g.panam
g.panam

Reputation: 11

A couple of things you can check:

  1. Check your plugin repositories (see https://cwiki.apache.org/MAVEN/maven-3x-compatibility-notes.html#Maven3.xCompatibilityNotes-PluginRepositories).
  2. Update your Maven version.

I had the same problem when I was using Maven 2 and when I upgraded to Maven 3 this problem went away.

Upvotes: 1

Raghuram
Raghuram

Reputation: 52665

Is it possible that you are behind a proxy server/firewall, which is preventing downloads of "jar" files?

Upvotes: 4

Benoit Courtine
Benoit Courtine

Reputation: 7074

The commons-lang 2.4 jar is on the Maven repo : http://repo1.maven.org/maven2/commons-lang/commons-lang/2.4/

There are several possibilities to solve your problem:

  • you can manually add the jar to your local repository, using the "mvn install:install-file" goal, or directly by putting the jar in the good directory
  • you can delete the commons-lang directory in your repository, and lauch Maven again. Sometimes, Maven download fails and a clenup of your local repository can solve the problem

Upvotes: 1

Related Questions