'"The POM for ... is missing, no dependency information available" even though it exists in Maven Repository

Problem:

A dependency will not download even though I copied it from the Maven Repository.

When I hover over the dependency in Eclipse, it warns: "Maven Missing artifact org.raml:jaxrs-code-generator:jar:2.0.0".

When I try mvn install or mvn compile it warns: "[WARNING] The POM for org.raml:jaxrs-code-generator:jar:2.0.0 is missing, no dependency information available".

Tried:

  • Downloading the jar into the ~/.m2/repository/org/raml/jaxrs-code-generator/2.0.0 folder, then refreshing in the editor.

    • When I install or compile it seems to ignore it.
  • Running mvn -U.

    • Same as with install or compile.

In-depth:

    <dependency>
        <groupId>org.raml</groupId>
        <artifactId>jaxrs-code-generator</artifactId>
        <version>2.0.0</version>
    </dependency>
  • The dependency exists in the Maven Repository (the version is also correct).

  • Using Eclipse EE Neon 4.6.3, Apache Maven 3.3.9, Java 1.8.0_121.

  • I have no settings.xml in the ~/.m2 folder.

  • I don't use any other repositories, local or otherwise.



Solution 1:[1]

Read carefully the warning message :

The POM for org.raml:jaxrs-code-generator:jar:2.0.0 is missing, no dependency information available

The problem is not the jar, but the pom.xml that is missing.
The pom.xml lists the required dependencies for this jar that Maven will pull during the build and overall the packaging of your application. So, you may really need it.

Note that this problem may of course occur for other Maven dependencies and the ideas to solve that is always the same.

The Mule website documents very well that in addition to some information related to.


How to solve ?

1) Quick workaround : looking for in the internet the pom.xml of the artifact

Googling the artifact id, the group id and its version gives generally interesting results : maven repository links to download it.
In the case of the org.raml:jaxrs-code-generator:jar:2.0.0 dependency, you can download the pom.xml from the Maven mule repository :

https://repository.mulesoft.org/nexus/content/repositories/releases/org/raml/jaxrs-code-generator/2.0.0/

2) Clean workaround for a single Maven project : adding the repository declaration in your pom.

In your case, add the Maven mule repositories :

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    ...
    <repositories>
        <repository>
            <id>mulesoft-releases</id>
            <name>MuleSoft Repository</name>
            <url>http://repository.mulesoft.org/releases/</url>
            <layout>default</layout>
        </repository>
        <repository>
            <id>mulesoft-snapshots</id>
            <name>MuleSoft Snapshot Repository</name>
            <url>http://repository.mulesoft.org/snapshots/</url>
            <layout>default</layout>
        </repository>
    </repositories>
    ...
</project>

3) Clean workaround for any Maven projects : add the repository declaration in your settings.xml

 <profile> 
   <repositories>
    ...
    <repository>
      <id>mulesoft-releases</id>
      <name>MuleSoft Repository</name>
      <url>http://repository.mulesoft.org/releases/</url>
      <layout>default</layout>
    </repository>
    <repository>
      <id>mulesoft-snapshots</id>
      <name>MuleSoft Snapshot Repository</name>
      <url>http://repository.mulesoft.org/snapshots/</url>
      <layout>default</layout>
    </repository>
     ...
  </repositories>     
</profile>

Note that in some rare cases, the pom.xml declaring the dependencies is nowhere. So, you have to identify yourself whether the artifact requires dependencies.

Solution 2:[2]

I had a similar problem quite recently. In my case:

  1. I downloaded an artifact from some less popular Maven repo

  2. This repo dissappeared over this year

  3. Now builds fail, even if I have this artifact and its pom.xml in my local repo

Workaround:

delete _remote.repositories file in your local repo, where this artifact resides. Now the project builds.

Solution 3:[3]

You will need to add external Repository to your pom, since this is using Mulsoft-Release repository not Maven Central

<project>
   ...
    <repositories>
        <repository>
            <id>mulesoft-releases</id>
            <name>MuleSoft Repository</name>
            <url>http://repository.mulesoft.org/releases/</url>
            <layout>default</layout>
        </repository>
    </repositories>
  ...
</project>

Dependency

Apache Maven - Setting up Multiple Repositories

Solution 4:[4]

If the POM missing warning is of project's self module, the reason is that you are trying to mistakenly build from a sub-module directory. You need to run the build and install command from root directory of the project.

Solution 5:[5]

Problem is not with the jar file. Maven is unable to fetch the correct meta data.

Delete the _maven.repositories or _remote.repositories (one of those files will be there) file and build again. Files are located in .m2/repository/path/to/your/repo/

Solution 6:[6]

Another option that can help is to reload the dependencies with

mvn dependency:resolve -U

Solution 7:[7]

This is my solution, may be it can helps I use IntelliJ IDE. File -> Setting -> Maven -> Importing change JDK for importer to 1.8( you can change to lower, higher)

Solution 8:[8]

In my case I was using Jade and I was using HTTP repository URL. Changing the Url to HTTPS worked for me.

Solution 9:[9]

In my case the reason was since the remote repo artifact (non-central) had dependencies from the Maven Central in the .pom file, and the older version of mvn (older than 3.6.0) was used. So, it tried to check the Maven Central artifacts mentioned in the remote repo's .pom for the specific artifact I've added to my dependencies and faced the Maven Central http access issue behind the scenes (I believe the same as described there: Maven dependencies are failing with a 501 error - that is about using https access to Maven Central by default and prohibiting the http access).

Using more recent Maven (from 3.1 to 3.6.0) made it use https to check Maven Central repo dependencies mentioned in the .pom files of the remote repositories and I no longer face the issue.

Solution 10:[10]

Could also be you have enabled: Work offline. In the intellij Maven -> Importing settings.

This was the case for me, I forgot I had this setting enabled.

Solution 11:[11]

I had the same error but not in the same use case. For me i use a multi modules project. But i use mvn clean package to compile some maven module, in other maven module it display the same error. My solution is that i should use mvn clean install instead of mvn clean package

package: will compile your code and also package it. For example, if your pom says the project is a jar, it will create a jar for you when you package it and put it somewhere in the target directory (by default).

install: will compile and package, but it will also put the package in your local repository. This will make it so other projects can refer to it and grab it from your local repository.

Solution 12:[12]

Search in the repository like https://search.maven.org/ that which version of the package is available.

In some cases, the latest version may not be available in the repo.