Search code examples
javamavennetbeans-8

Maven can not resolve dependencies


I am trying to build a project after long time and I am getting the following error.

Failed to execute goal on project The following artifacts could not be resolved:

org.restlet.jee:org.restlet:jar:2.1.7,

org.restlet.jee:org.restlet.ext.servlet:jar:2.1.7,

org.restlet.jee:org.restlet.ext.spring:jar:2.1.7,

org.restlet.jee:org.restlet.ext.freemarker:jar:2.1.7,

org.restlet.jee:org.restlet.ext.xml:jar:2.1.7:

Failure to find org.restlet.jee:org.restlet:jar:2.1.7

in http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

My pom.xml has the following dependency

<dependency>
  <groupId>org.restlet.jee</groupId>
  <artifactId>org.restlet.ext.servlet</artifactId>
  <version>${org.restlet.version}</version>
</dependency>

The repo is defined in following way:

   <repository>
        <id>central</id>
        <name>Maven Plugin Repositoty</name>
        <url>http://repo1.maven.org/maven2</url>
    </repository>

Solution

  • To figure out where to look for dependencies, one usually just starts with the site mvnrepository.com. This site not only helps you figure out the proper groupId, artifactId and version to use, but also indicates where exactly to find the artifact you need as not all artifacts are in Maven central.

    In this case the site will tell you they are in a repository maven.restlet.org, if you follow that url in a browser you will see this is indeed true. As such, you need that repository in your pom or settings.xml before the artifacts can be found.

    <repositories>
      <repository>
        <id>maven.restlet.org</id>
        <name>maven.restlet.org</name>
        <url>http://maven.restlet.org</url>
      </repository>        
    </repositories>    
    

    That will do it.