89

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.

JoseHdez_2
  • 4,040
  • 6
  • 27
  • 44
  • 1
    The given link does not point to Maven Central...In Maven Central only exist version 2.1.0 See here: http://search.maven.org/#search%7Cga%7C1%7Cjaxrs-code-generator – khmarbaise Aug 17 '17 at 08:55
  • Note: This error could also come due to dependency spelling case too. – Gaurav Dec 19 '18 at 10:25
  • I was receiving this error when attempting to download SNAPSHOT dependencies from a self-hosted Maven repo. The reason was because I had not enabled download of SNAPSHOT dependencies from the repo. To do this, you need add a specific section to the POM of the project that is in need of downloading SNAPSHOT versions of dependencies from your repo. See this answer for more: https://stackoverflow.com/questions/7715321/how-to-download-snapshot-version-from-maven-snapshot-repository – Matt Jan 13 '22 at 19:26

13 Answers13

41

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.

davidxxx
  • 125,838
  • 23
  • 214
  • 215
  • 3
    Why would anyone publish a repository to a public repository without a pom if it is needed? I just don't get that. – html_programmer Oct 16 '18 at 19:15
  • 44
    This doesn't solve the problem where pom.xml actually exists, but maven claims that it doesn't. – Dragas Oct 17 '18 at 10:23
  • 1
    @Trace Who did speak about publishing in a repository ? I referred to declare the repository that contains the pom.xml. It is different. – davidxxx Oct 17 '18 at 12:10
  • 1
    @Dragas Wha do you mean by that ? If Maven says that the pom.xml is not at the expected place, it is because it is the case. Do you have a specific case (maybe a question on SO or anything) to expose this case ? – davidxxx Oct 17 '18 at 12:13
  • @davidxxx Not really. The issue was incorrect pom structure. I had nested module aggregators and they wouldn't be indexed properly unless I defined `parent` as topmost module. – Dragas Oct 17 '18 at 12:27
  • Who creates settings.xml ? I created Maven Module project to use other Maven projects to create jar but facing same problem :( – Joker Jan 09 '20 at 11:31
  • 2
    @Joker From the doc : There are two locations where a settings.xml file may live: The Maven install: ${maven.home}/conf/settings.xml A user’s install: ${user.home}/.m2/settings.xml – davidxxx Feb 09 '20 at 07:25
  • as on 2020 the main reason would be using of Maven older than 3.6.0 for the repo that hosts dependencies that reference the Maven Central repo, no longer available through http (https only), so the proposed way here is to upgrade maven. – Eljah Oct 01 '20 at 19:38
26

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.

bleju
  • 261
  • 3
  • 5
  • 2
    deleting `.remote.repositories` file in my local repo it has solveed my problem too – Hayi Oct 30 '20 at 16:54
  • Where is this file located? Thanks! – manikanta nvsr Feb 19 '21 at 08:42
  • 3
    @manikantanvsr You should find this file in every directory of downloaded dependency in your local maven repo. For example for commons-lang3 it would be `.m2/repository/org/apache/commons/commons-lang3/3.4/_remote.repositories` – bleju Feb 21 '21 at 18:27
  • Directly deleting the local repository may cause inconsistencies for IDEs that may require multiple restarts to work back. Instead, use the maven-dependency-plugin: it will do everything for you! After you've specified it in your pom, run the command: mvn dependency:purge-local-repository -DactTransitively=false. – Davide Calarco May 13 '22 at 07:59
  • This worked for me, too. In my case, I had published a downloaded jar to one obscure repository years ago, then to a new repository recently, and wanted to import the resource from the new repo. – Jacob Crofts Aug 24 '22 at 17:13
6

Another option that can help is to reload the dependencies with

mvn dependency:resolve -U
serv-inc
  • 35,772
  • 9
  • 166
  • 188
4

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

XPLOT1ON
  • 2,994
  • 2
  • 20
  • 36
4

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/

3

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.

Sameer Sah
  • 65
  • 1
  • 7
1

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)

1

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.

Eljah
  • 4,188
  • 4
  • 41
  • 85
0

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

SLIMANI Mohammed
  • 407
  • 7
  • 10
0

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.

Mtodiy
  • 1
  • 1
0

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.

Youness HARDI
  • 402
  • 1
  • 3
  • 13
0

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.

itsazzad
  • 6,868
  • 7
  • 69
  • 89
0

I faced the same problem while using mvn dependency:go-offline.

The solution for me was using mvn verify instead.

Check out this topic for more info.

igops
  • 475
  • 3
  • 7