'How do I resolve "Failed to collect dependencies" error in Maven?

I'm using Maven 3 in my project. It's been sitting on the shelf for a while, but we recently started working on it again.

When I try to build it I'm getting the following error:

[ERROR] Failed to execute goal on project tahrir:
Could not resolve dependencies for project tahrirproject:tahrir:jar:0.0.1-SNAPSHOT:
Failed to collect dependencies for [com.google.code.gson:gson:jar:2.2.2 (compile), org.apache.commons:commons-math3:jar:3.0 (compile), args4j:args4j:jar:2.0.16 (compile), org.testng:testng:jar:5.14 (test), bouncycastle:bcprov-jdk16:jar:140 (compile), com.google.guava:guava:jar:13.0 (compile), ch.qos.logback:logback-classic:jar:0.9.28 (compile), com.miglayout:miglayout:jar:3.7.4 (compile), org.datanucleus:datanucleus-db4o:jar:3.0.0-m3 (compile), joda-time:joda-time:jar:1.6.2 (compile), com.google.inject:guice:jar:3.0 (compile), com.seaglasslookandfeel:seaglasslookandfeel:jar:0.2 (compile), xom:xom:jar:1.2.5 (compile), commons-codec:commons-codec:jar:1.6 (compile), org.apache.commons:commons-lang3:jar:3.1 (compile)]:
Failed to read artifact descriptor for db4o:db4o:jar:7.12.126.14142-all-java5: Could not transfer artifact db4o:db4o:pom:7.12.126.14142-all-java5 from/to local.repository (file:../../local.repository/trunk):
No connector available to access repository local.repository (file:../../local.repository/trunk) of type legacy using the available factories WagonRepositoryConnectorFactory -> [Help 1]

Here is my pom.xml file: https://github.com/sanity/tahrir/blob/master/pom.xml

I've seen that this can be related to trying to access Maven 1 or 2 repositories from Maven 3. If this is the issue I'd prefer to only use Maven 3 respositories, yet currently all of the dependencies I'm specifying should be in the default Maven repository, so I'm not sure what the issue is.

Any specific advice about how to properly "fix" our pom.xml file would be greatly appreciated.



Solution 1:[1]

After checking the repository which contains the artifacts but under different coordinates which means you have to change the given pom like this:

<repositories>
    <repository>
      <id>source.db4o</id>
      <url>http://source.db4o.com/maven</url>
    </repository>
  </repositories>
  ...
  <dependencies>
    <dependency>
      <groupId>com.db4o</groupId>
      <artifactId>db4o-full-java5</artifactId>
      <version>8.1-SNAPSHOT</version>
    </dependency>
    ...
  </dependencies>
</project>

If you take a look into the repository you will see the problem. But i recommend not to use SNAPSHOT's better use releases of the files.

Solution 2:[2]

We had a similar problem and fixed it by adding a wagon extension:

<build>
    <extensions>
        <extension>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-ssh</artifactId>
            <version>1.0</version>
        </extension>
    </extensions>
    ....
</build>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 khmarbaise
Solution 2 user4120528