Eclipse + maven cannot open POM even if it exists

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 main repository, and the other from another maven server.

Dependencies are successfully imported and displayed in the eclipse project. I can right-click on commons-lang3-3.1.jar in the package explorer and click Maven -> Open POM, and the pom file will open.

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

[ERROR] Failed to resolve the 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 if there are necessary files:

 \.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 is it impossible to overshadow / m 2e / maven to find and open this POM?

+6
source share
3 answers

Have you tried updating your local repository index? This is done by opening the Maven Repositories View in eclipse (Window> Show View> Other ..) and once inside the "Local Repositories" select "Rebuild Index".

+1
source

I am using SpringSource Tool Suite . It is based on Eclipse and allows you to get rid of installing the maven plugin on Eclipse, and also automatically resolves dependencies. This allows you to import a maven project, like other Java projects. Just click “Import” → “Import existing projects into the workspace” to have it.

The default path to .m2 \ settings.xml is used for the configuration and repo location, but you can always edit it by going to "Settings" → "Maven" → "User Settings".

+1
source

Hi, the problem is caused by * .lastupdated files. These files are generated if the dependency cannot be resolved for the first time and blocks the repository search for the corresponding artifact for 24 hours. (This was implemented in maven as a performance improvement) ... I assume that you added the repo after running into the problem that the dependency could not be resolved. Just delete the * .lastUpdated files and run the build again.

0
source

Source: https://habr.com/ru/post/918643/


All Articles