Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse + maven can't open POM even though it exists

Tags:

eclipse

maven

m2e

I have a maven project in eclipse, with some dependencies:

<repositories>
    <repository>
        <id>bukkit-repo</id>
        <url>http://repo.bukkit.org/content/groups/public/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.1</version>
    </dependency>
    <dependency>
        <groupId>org.bukkit</groupId>
        <artifactId>bukkit</artifactId>
        <version>1.2.5-R1.2</version>
    </dependency>
<dependency>

One (apache commons) is from the core repository, but the other comes from some other maven server.

The dependencies are successfully imported, and show up in the eclipse project. I can right click on commons-lang3-3.1.jar in the package explorer, and click on Maven -> Open POM, and the pom file opens.

However, if I do the same for bukkit-1.2.5-R1.2.jar, it fails with the message:

[ERROR] Could not resolve artifact org.bukkit:bukkit:pom:1.2.5-R1.2

The confusing part is that I can open the maven repository index created by eclipse, and see that the required files are there:

\.m2\repository\org\bukkit\bukkit\1.2.5-R1.2:
    bukkit-1.2.5-R1.2.jar
    bukkit-1.2.5-R1.2.jar.lastUpdated
    bukkit-1.2.5-R1.2.jar.sha1
    bukkit-1.2.5-R1.2.pom
    bukkit-1.2.5-R1.2.pom.lastUpdated
    bukkit-1.2.5-R1.2.pom.sha1
    ...

Why can't eclipse/m2e/maven find and open this POM?

like image 284
Eric Avatar asked Jun 21 '12 09:06

Eric


People also ask

How do I fix missing Maven dependencies in Eclipse?

You can find this in Window > Preferences > Maven > User Settings , and then point Global Settings to your external maven settings. xml . Then i removed the broken projects and re-added them, and the Maven Dependencies library appeared again. Save this answer.


1 Answers

Hi the problem is caused by the *.lastupdated files. Those files are generated if the dependency could not be resolved at the first time and block repository lookups for the according artifact for 24hours. (This was implemented in maven as performance improvement) ... I assume, that you added the repo after you ran into the problem, that the dependeny couldn't be resolved. Just delete the *.lastUpdated files and run the build again.

like image 147
vach Avatar answered Sep 30 '22 01:09

vach