无法计算构建计划:插件org.apache.m .plugins:maven-resources-plugin:2.5或其中一个依赖项无法解决?

时间:2021-11-05 10:43:15
org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5
    at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:129)
    at org.eclipse.m2e.core.internal.project.registry.EclipsePluginDependenciesResolver.resolve(EclipsePluginDependenciesResolver.java:48)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:142)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:261)
    at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:185)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecution(DefaultLifecycleExecutionPlanCalculator.java:152)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.setupMojoExecution(MavenImpl.java:386)
    at org.eclipse.m2e.core.internal.project.registry.ProjectRegistryManager.setupMojoExecution(ProjectRegistryManager.java:865)
    at org.eclipse.m2e.core.internal.project.registry.MavenProjectFacade.getMojoExecution(MavenProjectFacade.java:355)
    at org.eclipse.m2e.core.project.configurator.AbstractCustomizableLifecycleMapping.getBuildParticipants(AbstractCustomizableLifecycleMapping.java:66)
    at org.eclipse.m2e.core.project.configurator.AbstractLifecycleMapping.configure(AbstractLifecycleMapping.java:87)
    at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:414)
    at org.eclipse.m2e.core.internal.project.ProjectConfigurationManager.updateProjectConfiguration(ProjectConfigurationManager.java:351)
    at org.eclipse.m2e.core.ui.internal.UpdateMavenProjectJob.runInWorkspace(UpdateMavenProjectJob.java:74)
    at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:296)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:186)
    at org.sonatype.aether.impl.internal.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:279)
    at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:115)

I have read where many people were able to solve this by:

我读过很多人通过以下方法来解决这个问题:

I am new to Maven so please excuse any of my ignorance

我是Maven的新手,所以请原谅我的无知。

This project is working on another machine, and just pulled it down from the repository on this one, with the same version of eclipse and m2e plugin installed. I have been fooling with this for over 10 hours now and it is driving me nuts (Maven has been nothing but headaches for me so far...) Any help is tremendously appreciated! Thanks in advance!

这个项目正在另一台机器上运行,并将它从存储库中拉下来,安装了相同版本的eclipse和m2e插件。我花了10个多小时来玩这个游戏,这让我发疯(到目前为止,Maven一直让我头疼……)任何帮助都非常感谢!提前谢谢!

EDIT

编辑

After looking closer I did notice that it is not downloading the .jar files into the local repository... I am not sure if that is something obvious...

在仔细查看之后,我注意到它并没有将.jar文件下载到本地存储库中…我不确定这是不是显而易见的……

EDIT

编辑

I am not given the option to add Maven Dependencies to the build path.

我没有给构建路径添加Maven依赖项的选项。

27 个解决方案

#1


127  

I had the exact same problem.

我也有同样的问题。

[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5: Failure to find org.apache.maven.plugins:maven-resources-plugin:pom:2.5 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
...

Had maven 3.0.5, eclipse Kepler with JBoss Dev Studio 7 installed. Computer sitting on internal network with proxy to the internet. Here's what I did.

有了maven 3.0.5, JBoss Dev Studio 7安装了eclipse Kepler。计算机在内部网络上使用代理网络。这是我所做的。

0. Check the maven repositiory server is up

0。检查maven储存库是否已启动。

1. Check Proxy is set up and working

1。检查代理设置和工作。

First I thought it was a proxy problem, I made sure that maven settings.xml contained the proxy settings (settings.xml can exist in two places one in MAVEN_HOME. The other in %userprofile%.m2\ with the later having higher precedence):

首先,我认为这是一个代理问题,我确定了maven设置。xml包含代理设置(设置)。xml可以存在于MAVEN_HOME中的两个地方。另一个在% userprofile %。m2\有更高的优先级):

<proxy>
  <id>optional</id>
  <active>true</active>
  <protocol>http</protocol>
  <username>optional-proxyuser</username>
  <password>optional-proxypass</password>
  <host>proxy.host.net</host>
  <port>80</port>
  <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>

and checked that the proxy is working by trying to telnet to it:

并检查代理是否通过telnet工作:

telnet [proxy] [port number]

2. Check not Eclipse Issue

2。检查不是Eclipse问题

ran 'mvn compile' at command line level outside of eclipse - same issue.

在eclipse之外的命令行级别运行“mvn编译”——同样的问题。

If 'mvn compile' worked. But it doesn't work using the maven plugin in eclipse, see Maven plugin not using eclipse's proxy settings

如果mvn编译工作。但是在eclipse中使用maven插件是行不通的,可以看到maven插件不使用eclipse的代理设置。

3. Check not Cache Issue Deleted all contents in my local maven repository. (Default location: ~/.m2/repository) And then reran maven - same issue came up.

3所示。检查不缓存问题删除我本地maven存储库中的所有内容。(默认位置:~/.m2/存储库),然后重新运行maven——同样的问题出现了。

4. What worked for me

4所示。什么为我工作

Automatically download & install missing plugin: By declaring the missing plugin in the POM file build section for pluginManagement Maven will automatically retrieve the required plugin. In the POM file, add this code for the version of the plugin you require:

自动下载和安装丢失的插件:通过在POM文件构建部分中声明缺少的插件,插件管理Maven将自动检索所需的插件。在POM文件中,为你所需要的插件添加这段代码:

  <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <artifactId>maven-resources-plugin</artifactId>
              <version>2.7</version>
            </plugin>           
          </plugins>
        </pluginManagement>   
    </build>

Manually install missing plugin: I went to http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-resources-plugin/2.5 and downloaded maven-resources-plugin-2.5.jar and maven-resources-plugin-2.5.pom . Copied it directly into the maven repository into the correct folder ( ~/.m2/repository/org/apache/maven/plugins/maven-resources-plugin/2.5) and reran 'mvn compile'. This solved the problem.

手动安装丢失的插件:我访问了http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-resources-plugin/2.5,并下载了maven-resources-plugin-2.5。jar和maven -资源- plugin - 2.5。砰的一声。将它直接复制到maven存储库中,并将其直接复制到正确的文件夹(~/.m2/repository/org/apache/maven/plugins/maven-resources-plugin/2.5)并重新运行“mvn编译”。这解决了这个问题。


Edit1

Edit1

Following this I had another two problem with 'mvn install':

在此之后,我又遇到了“mvn安装”的两个问题:

The POM for org.apache.maven.plugins:maven-surefire-plugin:jar:2.10 is missing, no dependency information available

The POM for org.apache.maven.plugins:maven-install-plugin:jar:2.3.1 is missing, no dependency information available

I approached this problem the same way as above, downloading from http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-plugin/2.10 and http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-install-plugin/2.3.1

我以同样的方式处理这个问题,从http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire plugin/2.10和http://mvnrepository.com/artifact/org.apache.maven.maven.plugins/maven-install-plugin/2.3.1。

#2


106  

I had the exact same problem and since I read somewhere that the error was caused by a cached file, I fixed it by deleting all the files under the .m2 repository folder. The next time I built the project I had to download all the dependencies again but it was worth it - 0 errors!!

我有一个完全相同的问题,因为我在某处读到错误是由缓存文件引起的,所以我通过删除.m2储存库文件夹下的所有文件来修复它。当我下一次构建这个项目时,我不得不再次下载所有的依赖项,但它值得——0错误!!

#3


16  

Couple of things to try:

有几件事要尝试:

  1. Doublecheck the location of the local artifact repo configured in your settings.xml file (at the following location {your home folder}/.m2/settings.xml). Are you sure the local repo is where you think it is? (Yes, a mistake I've made in the past...)
  2. 双重检查在您的设置中配置的本地工件的位置。xml文件(在以下位置{您的家庭文件夹}/.m2/settings.xml)。你确定当地的回购协议是你认为的吗?(是的,我以前犯过一个错误……)
  3. Remove entire contents of artifact repo on the new build machine (or at least anything related to Maven). You mentioned doing some artifact repo cleanup but I'm not sure what directory(ies) you removed. I've run into weird issues like these when a jar was corrupted.
  4. 删除新构建机器上的工件repo的全部内容(或至少与Maven相关的任何内容)。您提到过做一些人工修复,但我不确定您删除了什么目录。我遇到了一些奇怪的问题,比如一个罐子坏了。
  5. Make sure you have enough disk space/quota for the local artifact repo. I have run into weird issues when I didn't have a large enough quota to hold all the artifacts, likely caused by partially downloaded jar files.
  6. 确保您有足够的本地工件的磁盘空间/配额。当我没有足够大的配额来保存所有工件时,我遇到了一些奇怪的问题,可能是由于部分下载的jar文件造成的。
  7. Try running with plain Maven on the command line; take Eclipse and m2e out of the equation. mvn -U dependency:resolve should do it. The -U forces Maven to download no matter what your repository update policies are. Add -X to get detailed debug logging.
  8. 尝试在命令行上与普通的Maven一起运行;把Eclipse和m2e去掉。依赖项:解决方案应该这样做。无论您的存储库更新策略是什么,-U强制Maven下载。添加-X以获得详细的调试日志。
  9. Copy settings.xml from MAVEN_HOME\conf\ to USER_HOME.m2. Add proxies (if needed) in case you are behind a proxy server.
  10. 复制设置。从MAVEN_HOME\conf\到USER_HOME.m2的xml。在代理服务器后面添加代理(如果需要)。

#4


7  

My problem was the location of the config file.

我的问题是配置文件的位置。

In eclipse settings (Windows->preferences->maven->User Settings) the default config file for maven points to C:\users\*yourUser*\.m2\settings.xml. If you unzip maven and install it in a folder of your choice the file will be inside *yourMavenInstallDir*/conf/, thus probably not where eclipse thinks (mine was not). If this is the case maven won't load correctly. You just need to set the "User Settings" path to point to the right file.

在eclipse设置中(Windows->首选项->maven->用户设置),maven的默认配置文件指向C:\用户\*yourUser*\.m2\settings.xml。如果您解压maven并将其安装到您选择的文件夹中,那么文件将位于*yourMavenInstallDir*/conf/中,因此可能不是eclipse认为(我的不是)的地方。如果是这样,maven将无法正确加载。您只需要设置“用户设置”路径指向正确的文件。

#5


7  

i faced the same issue while using eclipse kepler and maven version 3.2,

在使用eclipse kepler和maven 3.2版本时,我遇到了同样的问题,

while building the project, it showed me the same error in eclipse

在构建项目时,它在eclipse中显示了相同的错误。

there are two versions (2.5 and 2.6) of plugin under

有两个版本(2.5和2.6)的插件。

.m2/repository/org/apache/maven/plugins/maven-resources-plugin/

i removed 2.5 version then it worked for me

我删除了2.5版本,这对我很有效。

#6


6  

It appears that there can be a lot of different causes for this issue. I experienced it after installing a new version of Eclipse (Luna). Command-line maven worked fine, but Eclipse had build issues.

看来这个问题有很多不同的原因。在安装了Eclipse (Luna)的新版本之后,我体验到了它。命令行maven运行良好,但是Eclipse有构建问题。

I use a Certificate Authority in my JRE. This is important because this provides my authentication when downloading Maven resources. Even though my project was pointing to the appropriate JRE inside of Eclipse - Eclipse was running using a different JRE (this is apparent looking at the Java process properties in Windows task manager). My solution was to add the following in my eclipse.ini and explicitly define the JRE I want to use.

我在JRE中使用了证书授权。这很重要,因为这在下载Maven资源时提供了身份验证。尽管我的项目指向了Eclipse中适当的JRE, Eclipse正在使用不同的JRE运行(这显然是查看Windows任务管理器中的Java进程属性)。我的解决方案是在eclipse中添加以下内容。ini明确定义了我想要使用的JRE。

-vm
C:\Program Files\Java\jdk1.7.0_51\bin\javaw.exe 

#7


6  

i got it resolved by deleting the folder 2.6 in below location

我通过删除下面的文件夹2.6来解决这个问题。

.m2/repository/org/apache/maven/plugins/maven-resources-plugin/

Then i created a new maven project in eclipse luna and it worked fine

然后我在eclipse luna中创建了一个新的maven项目,它运行良好。

#8


3  

Try to delete all dirs in /usr/share/maven-repo - of course then maven will die so you must re-install and try again. In my case re-install from maven ver.3. to maven2 with deleting all repositories helped.

尝试删除/usr/share/maven-repo中所有的dirs,然后maven将会死亡,因此您必须重新安装并再次尝试。在我的案例中,从maven ver.3重新安装。使用删除所有存储库帮助maven2。

I tried by deleting all from .m2 but that didn't help.

我试着从。m2中删除,但那没有用。

#9


3  

None of the answers fixed it for me but I found the answer in this post: maven in 5 min not working, especially Solution #1.

没有一个答案为我解决了,但我在这篇文章中找到了答案:maven 5分钟不工作,特别是解决方案#1。

#10


3  

Some files where missing at your local repository. Usually under ${user.home}/.m2/repository/

在本地存储库中丢失的一些文件。通常在$ { user.home } / .m2 /仓库/

Neets answer solves the problem. However if you dont want do download all the dependencies to your local repository again you could add the missing dependency to a project of yours and compile it.

Neets的回答解决了这个问题。但是,如果您不想将所有依赖项下载到本地存储库中,那么您可以将缺失的依赖项添加到您的项目中并编译它。

Use the maven repository website to find the dependency. In your case http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-resources-plugin/2.5 was missing.

使用maven存储库网站来查找依赖项。在您的案例中,http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-resources-plugin/2.5丢失了。

Copy the listed XML to the pom.xml file of your project. In this case

将列出的XML复制到pom中。项目的xml文件。在这种情况下

<dependency>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.5</version>
</dependency>

Run mvn compile in the root folder of the pom.xml. Maven will download all missing dependencies. After the download you can remove the added dependency.

在pom.xml的根文件夹中运行mvn编译。Maven将下载所有丢失的依赖项。下载之后,您可以删除添加的依赖项。

Now you should be able to import the maven project or update the project without the error.

现在您应该能够导入maven项目或在没有错误的情况下更新项目。

#11


3  

What I found out is that while m2e is looking for v2.5 by default, my local repo has 2.6 and no 2.5.

我发现,虽然m2e在默认情况下正在寻找v2.5,但本地的repo是2.6和2.5。

Without going into investigation of how this came about simply adding the dependency to pom solved the problem

如果不深入研究这是如何实现的,只需添加对pom的依赖就可以解决这个问题。

<dependency>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.6</version>
</dependency>

This can be removed after running a build once

这可以在运行一次构建之后删除。

#12


2  

A more subtle reason for this could be a Settings.xml file which has a space in the first line before the doctype

一个更微妙的原因可能是设置。xml文件,它在doctype前面的第一行有一个空格。

#13


1  

I had the same problem but with an other cause. The solution was to deactivate Avira Browser Protection (in german Browser-Schutz). I took the solusion from m2e cannot transfer metadata from nexus, but maven command line can. It can be activated again ones maven has the needed plugin.

我有同样的问题,但还有其他原因。解决方案是停用Avira浏览器保护(在德国浏览器- schutz中)。我从m2e中获得的解决方案无法从nexus中传输元数据,但是maven命令行可以。它可以再次被激活,而maven有需要的插件。

#14


1  

Hopefully I'm not late for the party.

希望我不会迟到。

Encountered this using Eclipse Kepler and Maven 3.1.

使用Eclipse Kepler和Maven 3.1遇到了这个问题。

The solution is to use a JDK and not a JRE for your Eclipse project. Make sure to try maven clean and test from eclipse just to download missing jars.

解决方案是使用JDK,而不是为您的Eclipse项目使用JRE。确保从eclipse尝试maven的清洁和测试只是为了下载丢失的jar。

#15


1  

Most people will tell you to check your proxy settings or delete and re-add artifacts, but I will stay away from that and give another suggestion in case that doesn't turn out to be your problem. It could be your mirror settings.

大多数人会告诉你检查你的代理设置或删除和重新添加工件,但是我将远离这个,并给出另一个建议,以防这不是你的问题。它可以是你的镜像设置。

If you use maven at the office then there's a good chance maven is configured to look for your company's internal maven repository. If you're doing some work from home and you are not connected to the network this could be the problem. An obvious solution might be VPN to the office to get visibility to this repo. Another way around this is to add another mirror site to your /User/.m2/settings.xml file so if it fails to find it on your office network it will try public repo.

如果您在办公室使用maven,那么有一个很好的机会maven被配置为查找您公司的内部maven存储库。如果你在家做一些工作,而你没有连接到网络,这可能就是问题所在。一个明显的解决方案可能是VPN到办公室,以获得对这个repo的可见性。另一种方法是在您/User/.m2/设置中添加另一个镜像站点。xml文件如果在你的办公网络上找不到它,它会尝试公共回购。

<mirror>
    <id>Central</id>
    <url>http://repo1.maven.org/maven2</url>
    <mirrorOf>central</mirrorOf>
    <!-- United States, St. Louis-->
</mirror>

For other maven repositories take a look here: http://docs.codehaus.org/display/MAVENUSER/Mirrors+Repositories

对于其他maven存储库,请查看这里:http://docs.codehaus.org/display/mavenuser/镜像+存储库。

#16


1  

In my case I'm using an external maven installation with m2e. I've added my proxy settings to the external maven installation's settings.xml file. These settings haven't been used by m2e even after I've set the external maven installation as default maven installation.

在我的例子中,我使用的是m2e的外部maven安装。我已经将代理设置添加到外部maven安装的设置中。xml文件。即使在我将外部maven安装设置为默认maven安装之后,m2e也没有使用这些设置。

To solve the problem I've configured the global maven settings file within eclipse to be the settings.xml file from my external maven installation.

为了解决这个问题,我在eclipse中配置了全局maven设置文件作为设置。来自外部maven安装的xml文件。

Now eclipse can download the required artifacts.

现在eclipse可以下载所需的构件。

#17


1  

In addition to what @JackDev replies, what also solved my problem was to

除了@JackDev的回复,还解决了我的问题。

1) Install the jdk under directory with no spaces:

1)将jdk安装在没有空格的目录下:

C:/Java

Instead of

而不是

C:/Program Files/Java

This is a known issue in Windows. I fixed JAVA_HOME as well

这在Windows中是一个众所周知的问题。我也修复了JAVA_HOME。

2) Install maven as in Java case, under C:/Maven. Fixed the M2_HOME accordingly.

2)在C:/ maven下,将maven安装到Java实例中。相应固定M2_HOME。

3) I java 7 and java 8 on my laptop. So I defined the jvm using eclipse.ini. This is not a mandatory step if you don't have -vm entry in your eclipse.ini. I updated:

我的笔记本电脑上有java 7和java 8。所以我使用eclipse.ini来定义jvm。如果在eclipse.ini中没有-vm条目,这不是强制步骤。我更新:

C:/Java/jdk1.7.0_79/jre/bin/javaw.exe

Instead of:

而不是:

C:/Java/jdk1.7.0_79/bin/javaw.exe

Good luck

祝你好运

#18


1  

If you've configured a repository in your maven's settings.xml, check if you've access to it.

如果您已经在maven的设置中配置了一个存储库。xml,检查你是否能访问它。

When I had this problem, there were enterprise repositories configured in settings.xml but I was out of the company.

当我遇到这个问题时,在设置中配置了企业存储库。xml,但我不在公司。

#19


0  

JackDev's option 3 works for me after I changed the default repository to another folder.

在我将默认存储库更改为另一个文件夹之后,JackDev的选项3为我工作。

Below is what I see after M2E plugin automatically download the maven-resources-plugin-2.6. Maybe this could give you some hint if you want to take the manual approach. The necessary files can be downloaded from here: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.6/

下面是我看到的M2E插件自动下载maven-resources-plugin-2.6。如果你想采用手动方法,这可能会给你一些提示。必要的文件可以从这里下载:https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.6/。

无法计算构建计划:插件org.apache.m .plugins:maven-resources-plugin:2.5或其中一个依赖项无法解决?

#20


0  

If you have a proxy, you also have to clear SOCKS in

如果你有一个代理,你也必须清理袜子。

Window > Preferences > Network Connections.

#21


0  

After entering your proxy settings in settings.xml

在settings.xml中输入代理设置之后。

<proxies>
<!-- proxy 
 | Specification for one proxy, to be used in connecting to the network.
 |  -->
<proxy>
  <id>optional</id>
  <active>true</active>
  <protocol>http</protocol>
  <username>DOMAIN\YOURID</username>
  <password>123456</password>
  <host>proxy.company.com</host>
  <port>8080</port>
  <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>

</proxies>

Check whether the below tag is having the value false in settings.xml

检查下面的标记是否在settings.xml中有值false。

<offline>false</offline>

This helped me.

这帮助了我。

#22


0  

I was getting the same issue.

我也遇到了同样的问题。

I just installed the m2e (Maven2Eclipse)plugin from below site:

我刚从下面安装了m2e (Maven2Eclipse)插件:

http://www.eclipse.org/m2e/

Eclipse>Help>Install New Software>Available Software Sites>Add

Eclipse>帮助>安装新软件>可用的软件站点>添加。

Name: m2e (any name is OK)
Location:m2e - http://download.eclipse.org/technology/m2e/releases/

Under Install Window> Work with:

安装窗口>工作:

Select this new location and Add all the plugins that appear. Eclipse restart and it was running properly with no previous errors.

选择这个新位置并添加所有出现的插件。Eclipse重新启动,并且运行正常,没有以前的错误。

#23


0  

I had this problem for a long time and could not figure it out until I started looking into my system variables. Turns out I had my JAVA_HOME set to the JRE, and not the JDK.

我有这个问题很长时间了,直到我开始研究我的系统变量时才算出来。结果是,我将JAVA_HOME设置为JRE,而不是JDK。

#24


0  

Right click to your project >> Maven >> Update Project. And then build your project, it worked for me.

右击您的项目>> Maven >>更新项目。然后建立你的项目,它为我工作。

#25


0  

If your working at a company, they may be preventing you from downloading outside software and installing it. You may need to install the plugins manually or repoint to an internal mirror repository.

如果你在一家公司工作,他们可能会阻止你下载外部软件并安装它。您可能需要手动安装插件或重新指向内部镜像存储库。

#26


0  

Try downloading a different version of maven. I had the same problem with maven 3.5.2 , I solved my problem just downloading maven 3.0.4

尝试下载不同版本的maven。我在maven 3.5.2上遇到了同样的问题,我解决了我的问题,只下载maven 3.0.4。

#27


-1  

I handled my problem by adding bluesky to all-themes

我通过将bluesky添加到所有主题来处理我的问题。

<dependency>
   <groupId>org.primefaces.themes</groupId>
   <artifactId>all-themes</artifactId>
   <version>1.0.xx</version>
</dependency>

#1


127  

I had the exact same problem.

我也有同样的问题。

[ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5: Failure to find org.apache.maven.plugins:maven-resources-plugin:pom:2.5 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
...

Had maven 3.0.5, eclipse Kepler with JBoss Dev Studio 7 installed. Computer sitting on internal network with proxy to the internet. Here's what I did.

有了maven 3.0.5, JBoss Dev Studio 7安装了eclipse Kepler。计算机在内部网络上使用代理网络。这是我所做的。

0. Check the maven repositiory server is up

0。检查maven储存库是否已启动。

1. Check Proxy is set up and working

1。检查代理设置和工作。

First I thought it was a proxy problem, I made sure that maven settings.xml contained the proxy settings (settings.xml can exist in two places one in MAVEN_HOME. The other in %userprofile%.m2\ with the later having higher precedence):

首先,我认为这是一个代理问题,我确定了maven设置。xml包含代理设置(设置)。xml可以存在于MAVEN_HOME中的两个地方。另一个在% userprofile %。m2\有更高的优先级):

<proxy>
  <id>optional</id>
  <active>true</active>
  <protocol>http</protocol>
  <username>optional-proxyuser</username>
  <password>optional-proxypass</password>
  <host>proxy.host.net</host>
  <port>80</port>
  <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>

and checked that the proxy is working by trying to telnet to it:

并检查代理是否通过telnet工作:

telnet [proxy] [port number]

2. Check not Eclipse Issue

2。检查不是Eclipse问题

ran 'mvn compile' at command line level outside of eclipse - same issue.

在eclipse之外的命令行级别运行“mvn编译”——同样的问题。

If 'mvn compile' worked. But it doesn't work using the maven plugin in eclipse, see Maven plugin not using eclipse's proxy settings

如果mvn编译工作。但是在eclipse中使用maven插件是行不通的,可以看到maven插件不使用eclipse的代理设置。

3. Check not Cache Issue Deleted all contents in my local maven repository. (Default location: ~/.m2/repository) And then reran maven - same issue came up.

3所示。检查不缓存问题删除我本地maven存储库中的所有内容。(默认位置:~/.m2/存储库),然后重新运行maven——同样的问题出现了。

4. What worked for me

4所示。什么为我工作

Automatically download & install missing plugin: By declaring the missing plugin in the POM file build section for pluginManagement Maven will automatically retrieve the required plugin. In the POM file, add this code for the version of the plugin you require:

自动下载和安装丢失的插件:通过在POM文件构建部分中声明缺少的插件,插件管理Maven将自动检索所需的插件。在POM文件中,为你所需要的插件添加这段代码:

  <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <artifactId>maven-resources-plugin</artifactId>
              <version>2.7</version>
            </plugin>           
          </plugins>
        </pluginManagement>   
    </build>

Manually install missing plugin: I went to http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-resources-plugin/2.5 and downloaded maven-resources-plugin-2.5.jar and maven-resources-plugin-2.5.pom . Copied it directly into the maven repository into the correct folder ( ~/.m2/repository/org/apache/maven/plugins/maven-resources-plugin/2.5) and reran 'mvn compile'. This solved the problem.

手动安装丢失的插件:我访问了http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-resources-plugin/2.5,并下载了maven-resources-plugin-2.5。jar和maven -资源- plugin - 2.5。砰的一声。将它直接复制到maven存储库中,并将其直接复制到正确的文件夹(~/.m2/repository/org/apache/maven/plugins/maven-resources-plugin/2.5)并重新运行“mvn编译”。这解决了这个问题。


Edit1

Edit1

Following this I had another two problem with 'mvn install':

在此之后,我又遇到了“mvn安装”的两个问题:

The POM for org.apache.maven.plugins:maven-surefire-plugin:jar:2.10 is missing, no dependency information available

The POM for org.apache.maven.plugins:maven-install-plugin:jar:2.3.1 is missing, no dependency information available

I approached this problem the same way as above, downloading from http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-plugin/2.10 and http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-install-plugin/2.3.1

我以同样的方式处理这个问题,从http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire plugin/2.10和http://mvnrepository.com/artifact/org.apache.maven.maven.plugins/maven-install-plugin/2.3.1。

#2


106  

I had the exact same problem and since I read somewhere that the error was caused by a cached file, I fixed it by deleting all the files under the .m2 repository folder. The next time I built the project I had to download all the dependencies again but it was worth it - 0 errors!!

我有一个完全相同的问题,因为我在某处读到错误是由缓存文件引起的,所以我通过删除.m2储存库文件夹下的所有文件来修复它。当我下一次构建这个项目时,我不得不再次下载所有的依赖项,但它值得——0错误!!

#3


16  

Couple of things to try:

有几件事要尝试:

  1. Doublecheck the location of the local artifact repo configured in your settings.xml file (at the following location {your home folder}/.m2/settings.xml). Are you sure the local repo is where you think it is? (Yes, a mistake I've made in the past...)
  2. 双重检查在您的设置中配置的本地工件的位置。xml文件(在以下位置{您的家庭文件夹}/.m2/settings.xml)。你确定当地的回购协议是你认为的吗?(是的,我以前犯过一个错误……)
  3. Remove entire contents of artifact repo on the new build machine (or at least anything related to Maven). You mentioned doing some artifact repo cleanup but I'm not sure what directory(ies) you removed. I've run into weird issues like these when a jar was corrupted.
  4. 删除新构建机器上的工件repo的全部内容(或至少与Maven相关的任何内容)。您提到过做一些人工修复,但我不确定您删除了什么目录。我遇到了一些奇怪的问题,比如一个罐子坏了。
  5. Make sure you have enough disk space/quota for the local artifact repo. I have run into weird issues when I didn't have a large enough quota to hold all the artifacts, likely caused by partially downloaded jar files.
  6. 确保您有足够的本地工件的磁盘空间/配额。当我没有足够大的配额来保存所有工件时,我遇到了一些奇怪的问题,可能是由于部分下载的jar文件造成的。
  7. Try running with plain Maven on the command line; take Eclipse and m2e out of the equation. mvn -U dependency:resolve should do it. The -U forces Maven to download no matter what your repository update policies are. Add -X to get detailed debug logging.
  8. 尝试在命令行上与普通的Maven一起运行;把Eclipse和m2e去掉。依赖项:解决方案应该这样做。无论您的存储库更新策略是什么,-U强制Maven下载。添加-X以获得详细的调试日志。
  9. Copy settings.xml from MAVEN_HOME\conf\ to USER_HOME.m2. Add proxies (if needed) in case you are behind a proxy server.
  10. 复制设置。从MAVEN_HOME\conf\到USER_HOME.m2的xml。在代理服务器后面添加代理(如果需要)。

#4


7  

My problem was the location of the config file.

我的问题是配置文件的位置。

In eclipse settings (Windows->preferences->maven->User Settings) the default config file for maven points to C:\users\*yourUser*\.m2\settings.xml. If you unzip maven and install it in a folder of your choice the file will be inside *yourMavenInstallDir*/conf/, thus probably not where eclipse thinks (mine was not). If this is the case maven won't load correctly. You just need to set the "User Settings" path to point to the right file.

在eclipse设置中(Windows->首选项->maven->用户设置),maven的默认配置文件指向C:\用户\*yourUser*\.m2\settings.xml。如果您解压maven并将其安装到您选择的文件夹中,那么文件将位于*yourMavenInstallDir*/conf/中,因此可能不是eclipse认为(我的不是)的地方。如果是这样,maven将无法正确加载。您只需要设置“用户设置”路径指向正确的文件。

#5


7  

i faced the same issue while using eclipse kepler and maven version 3.2,

在使用eclipse kepler和maven 3.2版本时,我遇到了同样的问题,

while building the project, it showed me the same error in eclipse

在构建项目时,它在eclipse中显示了相同的错误。

there are two versions (2.5 and 2.6) of plugin under

有两个版本(2.5和2.6)的插件。

.m2/repository/org/apache/maven/plugins/maven-resources-plugin/

i removed 2.5 version then it worked for me

我删除了2.5版本,这对我很有效。

#6


6  

It appears that there can be a lot of different causes for this issue. I experienced it after installing a new version of Eclipse (Luna). Command-line maven worked fine, but Eclipse had build issues.

看来这个问题有很多不同的原因。在安装了Eclipse (Luna)的新版本之后,我体验到了它。命令行maven运行良好,但是Eclipse有构建问题。

I use a Certificate Authority in my JRE. This is important because this provides my authentication when downloading Maven resources. Even though my project was pointing to the appropriate JRE inside of Eclipse - Eclipse was running using a different JRE (this is apparent looking at the Java process properties in Windows task manager). My solution was to add the following in my eclipse.ini and explicitly define the JRE I want to use.

我在JRE中使用了证书授权。这很重要,因为这在下载Maven资源时提供了身份验证。尽管我的项目指向了Eclipse中适当的JRE, Eclipse正在使用不同的JRE运行(这显然是查看Windows任务管理器中的Java进程属性)。我的解决方案是在eclipse中添加以下内容。ini明确定义了我想要使用的JRE。

-vm
C:\Program Files\Java\jdk1.7.0_51\bin\javaw.exe 

#7


6  

i got it resolved by deleting the folder 2.6 in below location

我通过删除下面的文件夹2.6来解决这个问题。

.m2/repository/org/apache/maven/plugins/maven-resources-plugin/

Then i created a new maven project in eclipse luna and it worked fine

然后我在eclipse luna中创建了一个新的maven项目,它运行良好。

#8


3  

Try to delete all dirs in /usr/share/maven-repo - of course then maven will die so you must re-install and try again. In my case re-install from maven ver.3. to maven2 with deleting all repositories helped.

尝试删除/usr/share/maven-repo中所有的dirs,然后maven将会死亡,因此您必须重新安装并再次尝试。在我的案例中,从maven ver.3重新安装。使用删除所有存储库帮助maven2。

I tried by deleting all from .m2 but that didn't help.

我试着从。m2中删除,但那没有用。

#9


3  

None of the answers fixed it for me but I found the answer in this post: maven in 5 min not working, especially Solution #1.

没有一个答案为我解决了,但我在这篇文章中找到了答案:maven 5分钟不工作,特别是解决方案#1。

#10


3  

Some files where missing at your local repository. Usually under ${user.home}/.m2/repository/

在本地存储库中丢失的一些文件。通常在$ { user.home } / .m2 /仓库/

Neets answer solves the problem. However if you dont want do download all the dependencies to your local repository again you could add the missing dependency to a project of yours and compile it.

Neets的回答解决了这个问题。但是,如果您不想将所有依赖项下载到本地存储库中,那么您可以将缺失的依赖项添加到您的项目中并编译它。

Use the maven repository website to find the dependency. In your case http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-resources-plugin/2.5 was missing.

使用maven存储库网站来查找依赖项。在您的案例中,http://mvnrepository.com/artifact/org.apache.maven.plugins/maven-resources-plugin/2.5丢失了。

Copy the listed XML to the pom.xml file of your project. In this case

将列出的XML复制到pom中。项目的xml文件。在这种情况下

<dependency>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.5</version>
</dependency>

Run mvn compile in the root folder of the pom.xml. Maven will download all missing dependencies. After the download you can remove the added dependency.

在pom.xml的根文件夹中运行mvn编译。Maven将下载所有丢失的依赖项。下载之后,您可以删除添加的依赖项。

Now you should be able to import the maven project or update the project without the error.

现在您应该能够导入maven项目或在没有错误的情况下更新项目。

#11


3  

What I found out is that while m2e is looking for v2.5 by default, my local repo has 2.6 and no 2.5.

我发现,虽然m2e在默认情况下正在寻找v2.5,但本地的repo是2.6和2.5。

Without going into investigation of how this came about simply adding the dependency to pom solved the problem

如果不深入研究这是如何实现的,只需添加对pom的依赖就可以解决这个问题。

<dependency>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.6</version>
</dependency>

This can be removed after running a build once

这可以在运行一次构建之后删除。

#12


2  

A more subtle reason for this could be a Settings.xml file which has a space in the first line before the doctype

一个更微妙的原因可能是设置。xml文件,它在doctype前面的第一行有一个空格。

#13


1  

I had the same problem but with an other cause. The solution was to deactivate Avira Browser Protection (in german Browser-Schutz). I took the solusion from m2e cannot transfer metadata from nexus, but maven command line can. It can be activated again ones maven has the needed plugin.

我有同样的问题,但还有其他原因。解决方案是停用Avira浏览器保护(在德国浏览器- schutz中)。我从m2e中获得的解决方案无法从nexus中传输元数据,但是maven命令行可以。它可以再次被激活,而maven有需要的插件。

#14


1  

Hopefully I'm not late for the party.

希望我不会迟到。

Encountered this using Eclipse Kepler and Maven 3.1.

使用Eclipse Kepler和Maven 3.1遇到了这个问题。

The solution is to use a JDK and not a JRE for your Eclipse project. Make sure to try maven clean and test from eclipse just to download missing jars.

解决方案是使用JDK,而不是为您的Eclipse项目使用JRE。确保从eclipse尝试maven的清洁和测试只是为了下载丢失的jar。

#15


1  

Most people will tell you to check your proxy settings or delete and re-add artifacts, but I will stay away from that and give another suggestion in case that doesn't turn out to be your problem. It could be your mirror settings.

大多数人会告诉你检查你的代理设置或删除和重新添加工件,但是我将远离这个,并给出另一个建议,以防这不是你的问题。它可以是你的镜像设置。

If you use maven at the office then there's a good chance maven is configured to look for your company's internal maven repository. If you're doing some work from home and you are not connected to the network this could be the problem. An obvious solution might be VPN to the office to get visibility to this repo. Another way around this is to add another mirror site to your /User/.m2/settings.xml file so if it fails to find it on your office network it will try public repo.

如果您在办公室使用maven,那么有一个很好的机会maven被配置为查找您公司的内部maven存储库。如果你在家做一些工作,而你没有连接到网络,这可能就是问题所在。一个明显的解决方案可能是VPN到办公室,以获得对这个repo的可见性。另一种方法是在您/User/.m2/设置中添加另一个镜像站点。xml文件如果在你的办公网络上找不到它,它会尝试公共回购。

<mirror>
    <id>Central</id>
    <url>http://repo1.maven.org/maven2</url>
    <mirrorOf>central</mirrorOf>
    <!-- United States, St. Louis-->
</mirror>

For other maven repositories take a look here: http://docs.codehaus.org/display/MAVENUSER/Mirrors+Repositories

对于其他maven存储库,请查看这里:http://docs.codehaus.org/display/mavenuser/镜像+存储库。

#16


1  

In my case I'm using an external maven installation with m2e. I've added my proxy settings to the external maven installation's settings.xml file. These settings haven't been used by m2e even after I've set the external maven installation as default maven installation.

在我的例子中,我使用的是m2e的外部maven安装。我已经将代理设置添加到外部maven安装的设置中。xml文件。即使在我将外部maven安装设置为默认maven安装之后,m2e也没有使用这些设置。

To solve the problem I've configured the global maven settings file within eclipse to be the settings.xml file from my external maven installation.

为了解决这个问题,我在eclipse中配置了全局maven设置文件作为设置。来自外部maven安装的xml文件。

Now eclipse can download the required artifacts.

现在eclipse可以下载所需的构件。

#17


1  

In addition to what @JackDev replies, what also solved my problem was to

除了@JackDev的回复,还解决了我的问题。

1) Install the jdk under directory with no spaces:

1)将jdk安装在没有空格的目录下:

C:/Java

Instead of

而不是

C:/Program Files/Java

This is a known issue in Windows. I fixed JAVA_HOME as well

这在Windows中是一个众所周知的问题。我也修复了JAVA_HOME。

2) Install maven as in Java case, under C:/Maven. Fixed the M2_HOME accordingly.

2)在C:/ maven下,将maven安装到Java实例中。相应固定M2_HOME。

3) I java 7 and java 8 on my laptop. So I defined the jvm using eclipse.ini. This is not a mandatory step if you don't have -vm entry in your eclipse.ini. I updated:

我的笔记本电脑上有java 7和java 8。所以我使用eclipse.ini来定义jvm。如果在eclipse.ini中没有-vm条目,这不是强制步骤。我更新:

C:/Java/jdk1.7.0_79/jre/bin/javaw.exe

Instead of:

而不是:

C:/Java/jdk1.7.0_79/bin/javaw.exe

Good luck

祝你好运

#18


1  

If you've configured a repository in your maven's settings.xml, check if you've access to it.

如果您已经在maven的设置中配置了一个存储库。xml,检查你是否能访问它。

When I had this problem, there were enterprise repositories configured in settings.xml but I was out of the company.

当我遇到这个问题时,在设置中配置了企业存储库。xml,但我不在公司。

#19


0  

JackDev's option 3 works for me after I changed the default repository to another folder.

在我将默认存储库更改为另一个文件夹之后,JackDev的选项3为我工作。

Below is what I see after M2E plugin automatically download the maven-resources-plugin-2.6. Maybe this could give you some hint if you want to take the manual approach. The necessary files can be downloaded from here: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.6/

下面是我看到的M2E插件自动下载maven-resources-plugin-2.6。如果你想采用手动方法,这可能会给你一些提示。必要的文件可以从这里下载:https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.6/。

无法计算构建计划:插件org.apache.m .plugins:maven-resources-plugin:2.5或其中一个依赖项无法解决?

#20


0  

If you have a proxy, you also have to clear SOCKS in

如果你有一个代理,你也必须清理袜子。

Window > Preferences > Network Connections.

#21


0  

After entering your proxy settings in settings.xml

在settings.xml中输入代理设置之后。

<proxies>
<!-- proxy 
 | Specification for one proxy, to be used in connecting to the network.
 |  -->
<proxy>
  <id>optional</id>
  <active>true</active>
  <protocol>http</protocol>
  <username>DOMAIN\YOURID</username>
  <password>123456</password>
  <host>proxy.company.com</host>
  <port>8080</port>
  <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>

</proxies>

Check whether the below tag is having the value false in settings.xml

检查下面的标记是否在settings.xml中有值false。

<offline>false</offline>

This helped me.

这帮助了我。

#22


0  

I was getting the same issue.

我也遇到了同样的问题。

I just installed the m2e (Maven2Eclipse)plugin from below site:

我刚从下面安装了m2e (Maven2Eclipse)插件:

http://www.eclipse.org/m2e/

Eclipse>Help>Install New Software>Available Software Sites>Add

Eclipse>帮助>安装新软件>可用的软件站点>添加。

Name: m2e (any name is OK)
Location:m2e - http://download.eclipse.org/technology/m2e/releases/

Under Install Window> Work with:

安装窗口>工作:

Select this new location and Add all the plugins that appear. Eclipse restart and it was running properly with no previous errors.

选择这个新位置并添加所有出现的插件。Eclipse重新启动,并且运行正常,没有以前的错误。

#23


0  

I had this problem for a long time and could not figure it out until I started looking into my system variables. Turns out I had my JAVA_HOME set to the JRE, and not the JDK.

我有这个问题很长时间了,直到我开始研究我的系统变量时才算出来。结果是,我将JAVA_HOME设置为JRE,而不是JDK。

#24


0  

Right click to your project >> Maven >> Update Project. And then build your project, it worked for me.

右击您的项目>> Maven >>更新项目。然后建立你的项目,它为我工作。

#25


0  

If your working at a company, they may be preventing you from downloading outside software and installing it. You may need to install the plugins manually or repoint to an internal mirror repository.

如果你在一家公司工作,他们可能会阻止你下载外部软件并安装它。您可能需要手动安装插件或重新指向内部镜像存储库。

#26


0  

Try downloading a different version of maven. I had the same problem with maven 3.5.2 , I solved my problem just downloading maven 3.0.4

尝试下载不同版本的maven。我在maven 3.5.2上遇到了同样的问题,我解决了我的问题,只下载maven 3.0.4。

#27


-1  

I handled my problem by adding bluesky to all-themes

我通过将bluesky添加到所有主题来处理我的问题。

<dependency>
   <groupId>org.primefaces.themes</groupId>
   <artifactId>all-themes</artifactId>
   <version>1.0.xx</version>
</dependency>