Java “缺少...的 POM,没有可用的依赖信息”,即使它存在于 Maven 存储库中
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45730541/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"The POM for ... is missing, no dependency information available" even though it exists in Maven Repository
提问by JoseHdez_2
Problem:
问题:
A dependency will not download even though I copied it from the Maven Repository.
即使我从 Maven 存储库复制了依赖项,也不会下载它。
When I hover over the dependency in Eclipse, it warns: "Maven Missing artifact org.raml:jaxrs-code-generator:jar:2.0.0
".
当我将鼠标悬停在 Eclipse 中的依赖项上时,它会警告:“ 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
".
当我尝试mvn install
或mvn compile
它警告:“ [WARNING] The POM for org.raml:jaxrs-code-generator:jar:2.0.0 is missing, no dependency information available
”。
Tried:
尝试:
Downloading the jarinto the
~/.m2/repository/org/raml/jaxrs-code-generator/2.0.0
folder, then refreshing in the editor.- When I
install
orcompile
it seems to ignore it.
- When I
Running
mvn -U
.- Same as with
install
orcompile
.
- Same as with
将jar下载到
~/.m2/repository/org/raml/jaxrs-code-generator/2.0.0
文件夹中,然后在编辑器中刷新。- 当我
install
或compile
它似乎忽略它时。
- 当我
运行
mvn -U
。- 与
install
或相同compile
。
- 与
In-depth:
深入:
<dependency>
<groupId>org.raml</groupId>
<artifactId>jaxrs-code-generator</artifactId>
<version>2.0.0</version>
</dependency>
The dependency existsin 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.
依赖存在于Maven Repository中(版本也是正确的)。
使用 Eclipse EE Neon 4.6.3、Apache Maven 3.3.9、Java 1.8.0_121。
我
settings.xml
的~/.m2
文件夹里没有。我不使用任何其他存储库,本地或其他。
采纳答案by davidxxx
Read carefully the warning message :
仔细阅读警告信息:
The POM for org.raml:jaxrs-code-generator:jar:2.0.0 is missing, no dependency information available
org.raml:jaxrs-code-generator:jar:2.0.0 的 POM 丢失,没有可用的依赖信息
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.
问题不是 jar,而是缺少的 pom.xml。
pom.xml 列出了这个 jar 所需的依赖项,Maven 将在构建和整个应用程序打包期间提取这些依赖项。
所以,你可能真的需要它。
Note that this problem may of course occur for other Maven dependencies and the ideas to solve that is always the same.
请注意,这个问题当然可能发生在其他 Maven 依赖项上,解决这个问题的想法总是一样的。
The Mule websitedocuments very well that in addition to some information related to.
Mule 网站文档很好,除了一些相关的信息。
How to solve ?
怎么解决 ?
1) Quick workaround : looking for in the internet the pom.xml
of the artifact
1)快速解决方法:在互联网上寻找pom.xml
神器的
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 :
谷歌搜索工件 id、组 id 及其版本通常会给出有趣的结果:maven 存储库链接以下载它。
在org.raml:jaxrs-code-generator:jar:2.0.0
依赖的情况下,您可以pom.xml
从 Maven mule 存储库下载:
2) Clean workaround for a single Maven project : adding the repository declaration in your pom.
2) 单个 Maven 项目的清理解决方法:在 pom.xml 中添加存储库声明。
In your case, add the Maven mule repositories :
在您的情况下,添加 Maven mule 存储库:
<?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
3) 清理任何 Maven 项目的解决方法:在您的项目中添加存储库声明 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.
请注意,在极少数情况下,pom.xml
声明依赖项是无处可去的。因此,您必须确定工件是否需要依赖项。
回答by XPLOT1ON
You will need to add external Repository to your pom, since this is using Mulsoft-Release
repository not Maven Central
您需要将外部存储库添加到您的 pom 中,因为这是使用Mulsoft-Release
存储库而不是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>
回答by SLIMANI Mohammed
In my case I was using Jade and I was using HTTP repository URL. Changing the Url to HTTPS worked for me.
就我而言,我使用的是 Jade,我使用的是 HTTP 存储库 URL。将 URL 更改为 HTTPS 对我有用。
回答by h?i anh tr??ng
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)
这是我的解决方案,可能可以帮助我使用 IntelliJ IDE。文件 -> 设置 -> Maven -> 导入 将导入器的 JDK 更改为 1.8(您可以更改为更低、更高)
回答by bleju
I had a similar problem quite recently. In my case:
我最近遇到了类似的问题。就我而言:
I downloaded an artifact from some less popular Maven repo
This repo dissappeared over this year
Now builds fail, even if I have this artifact and its pom.xml in my local repo
我从一些不太受欢迎的 Maven 存储库下载了一个工件
这个回购在今年消失了
现在构建失败,即使我的本地存储库中有这个工件及其 pom.xml
Workaround:
解决方法:
delete .remote.repositoriesfile in your local repo, where this artifact resides. Now the project builds.
删除此工件所在的本地存储库中的.remote.repositories文件。现在项目构建。