Reputation: 97565
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?
Upvotes: 7
Views: 12267
Reputation: 2102
I use SpringSource Tool Suite. It's based on Eclipse and let's you do away with installing maven plugin on Eclipse and also resolves the dependencies automatically. It let's you import maven project like other Java projects. Just click on "Import" -> "Import existing projects into workspace", that's it.
For config and repo location, by default it uses the path to .m2\settings.xml but you can always edit it by going to "Preferences" -> "Maven" -> "User Settings".
Upvotes: 1
Reputation: 1865
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.
Upvotes: 2
Reputation: 340
did you try to update your local repository index? This is done by opening the Maven Repositories View in eclipse (Window > Show View > Other..) and once inside "Local Repositories" select Rebuild Index.
Upvotes: 1