user2196234
user2196234

Reputation: 71

Maven Dependencies references non existing library

As stated above I have a problem regarding maven. In my current eclipse project I used maven for dependecy management and it worked fine until now.

The project is not working anymore and it states that:

Maven Dependencies references non existing library: 
  c:\.m2\repository\org\eclipse\lyo\oslc4j\core\oslc4j-core\1.1\oslc4j-core-1.1.jar'

If i check the folder there are files that have the same name as the jar but end on jar.lastUpdated.

I tried maven clean and maven update which did not work. The line in my pom.xml is marked red and states:

Missing artifact org.eclipse.lyo.oslc4j.core:oslc4j-core:jar:1.1

This is the content of my pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http:/www.w3.org2001XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.or/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>rtc_oslc_common</groupId>
<artifactId>rtc_oslc_common</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
  <sourceDirectory>src</sourceDirectory>
  <plugins>
    <plugin>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>2.3.2</version>
      <configuration>
        <source>1.6</source>
        <target>1.6</target>
      </configuration>
    </plugin>
  </plugins>
</build>

This block is the one with the marker where it states the artifact is missing.

<dependencies>
  <dependency>
    <groupId>org.eclipse.lyo.oslc4j.core</groupId>
    <artifactId>oslc4j-core</artifactId>
    <version>1.1</version>
  </dependency>
</dependencies>
</project>

I don't know why it is not just reloading the jars and instead stays in this weird state. Help very much appriaciated.

Upvotes: 3

Views: 26856

Answers (4)

Ertuğrul KOMUT
Ertuğrul KOMUT

Reputation: 1

Firstly, you repair, intenet problem. after that You must delete folders in maven repository folder. (For me C:\Users\ekomut.m2\repository)

If you have an Internet problem, you can see "*.jar.lastUpdated" .If you don't delete this folder, maven can not try download again.

Upvotes: 0

CorningSun
CorningSun

Reputation: 23

I got the error like this:

The container 'Maven Dependencies' references non existing library 'G:\m2\repository\org\apache\tomcat\tomcat-embed\7.0.65\tomcat-embed-7.0.65.jar'

I found the tomcat-embed is actually a *.pom file but not a *.jar

<dependency>
  <groupId>org.apache.tomcat</groupId>
  <artifactId>tomcat-embed</artifactId>
  <version>7.0.65</version>
  <type>pom</type>
</dependency>

So I fixed this problem by:

  1. delete tomcat-embed-7.0.65.jar.lastUpdated
  2. copy a *.jar file to dir G:\m2\repository\org\apache\tomcat\tomcat-embed\7.0.65\
  3. renamed to tomcat-embed-7.0.65.jar

But the other way to solve this problem?

Upvotes: 0

Brian White
Brian White

Reputation: 8716

Sometimes an officially stated dependency configuration is incorrect, too. For example, as of 2015-05-23 the Robolectric site says...

<dependency>
   <groupId>org.robolectric</groupId>
   <artifactId>robolectric</artifactId>
   <version>3.0</version>
   <scope>test</scope>
</dependency>

... which gives the same error you describe. After banging my head for a while (of course this was the first time I've ever tried Maven), I ended up checking at Maven Central this URL: http://mvnrepository.com/artifact/org.robolectric/robolectric

Lo and behold, there is no version 3.0. Instead, there are versions "3.0-rc1" and "3.0-rc2". When I changed the dependency to "3.0-rc2", suddenly everything worked.

Upvotes: 0

chkal
chkal

Reputation: 5668

Basically Maven is telling you that it cannot find the dependency you declared in your pom.xml. The fact that there is a file called *.jar.lastUpdated means that Maven tried to download the dependency but wasn't able to fetch it.

First you could try to completely delete the folder containing the *.jar.lastUpdated and run the build again. Maven will then try to download the dependency again. Perhaps it was just a temporary error.

But as this dependency is not available in Maven Central, you may have to add the corresponding repository to your pom.xml.

Upvotes: 3

Related Questions