jar-plugin:2.3.2或其某个依赖项无法解析

bakd9h0s  于 2021-06-30  发布在  Java
关注(0)|答案(21)|浏览(336)

当我试图在eclipse中创建maven项目时,得到了以下错误消息。许多人在settings.xml文件中发布了关于代理的信息,还刷新了.m2文件夹,迫使它下载一个新的。这些对我都不管用。我在工作,代理设置活跃在互联网选项。
错误消息:

Could not calculate build plan: 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
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

pom.xml文件:

<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>
  <groupId>com.blahhhhhhhhhhhhhhhhh</groupId>
  <artifactId>HelloRESTEasy</artifactId>
  <version>0.0.1-SNAPSHOT</version>
</project>

设置.xml:

<proxies>
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>proxyuser</username>
      <password>proxypass</password>
      <host>proxyserver.company.com</host>
      <port>8080</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
  </proxies>
dsekswqp

dsekswqp1#

我犯了这个错误,我遵循以下三个步骤来解决,
1). 检查settings.xml中的代理设置,
2). .m2 diretory释放导致问题的缓存文件
3) 将eclipse指向正确的jdk安装。请参阅此环境中没有提供编译器。也许您运行的是jre而不是jdk?知道怎么做

xyhw6mcr

xyhw6mcr2#

试着打扫一下当地的房间 .m2/repository/ 手动使用文件夹 rm -rf 然后重建项目。在尝试了所有其他可能的替代方案(重新安装eclipse,指向eclipse中正确的maven版本,代理设置等)之后,我成功了

b4qexyjb

b4qexyjb3#

也许你的网络很慢,所以jar没有完全下载。
有两种方法:
答。找到你的.m2文件夹,你可以找到像这样的路径'org/apache/maven/plugins/maven resources plugin',你只需要删除这个文件夹'maven resources plugin',因为其他的都下载得很好。
然后maven构建您的项目。
如果出现其他问题,请再次重复此过程。
b。您可以更快速地更改maven源代码。
首先,您应该找到maven的设置文件(窗口->首选项->maven->用户设置)。如果为空,则可以创建新路径(任何路径,例如.m2/settings)。
第二,加上这样的东西https://blog.csdn.net/liangyihuai/article/details/57406870). 这个例子使用了aliyun的maven。

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                          https://maven.apache.org/xsd/settings-1.0.0.xsd">

      <mirrors>
        <mirror>  
            <id>alimaven</id>  
            <name>aliyun maven</name>  
            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
            <mirrorOf>central</mirrorOf>          
        </mirror>  
      </mirrors>
</settings>

第三,maven重新构建(在此之前,您应该删除.m2文件夹的文件)

emeijp43

emeijp434#

这主要发生在eclipse升级期间。
我用以下方法解决:
->右键单击项目->maven->更新项目->全选(复选框)
旧的或过时的项目用更新的jar文件和所需的插件进行了刷新。没有更多的错误可见。

dffbzjpn

dffbzjpn5#

在我的例子中,错误是:coreexception:could not calculate build plan:plugin org.apache.maven。plugins:maven-compiler-plugin:2.3.2 ....
从pom.xml文件夹中的控制台使用eclipse luna

mvn clean
mvn install

对于juno,我不得不把它放到pom.xml中

<build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>2.3.2</version>
          <configuration>
            <!-- put your configurations here -->
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

然后

mvn install

然后从eclipse右键单击>maven>updateproject*一旦插件加载完毕,就可以从pom.xml中删除插件

jecbmhm3

jecbmhm36#

可能有多种原因,我通过以下步骤修复:
删除.m2文件夹并重新启动eclipse(在windows中查找m2文件夹:c:\users\your\u user name.m2或在mac中搜索:~/.m2
确保settings.xml配置为#justinbieber。
在eclipse中提供settings.xml路径(windows->preferences->maven->user settings)user settings必须找到settings.xml文件。
保存更改并重新启动eclipse。。!!应该有用。

dsekswqp

dsekswqp7#

我已经总结了我为我的问题所做的工作。
1) 删除.m2文件夹。2) 更改apache-maven-3.5.4\conf\settings.xml如下

<proxies>
<proxy>
  <id>optional</id>
  <active>true</active>
  <protocol>http</protocol>
  <host>proxyserver.company.com</host> --> Please change it according to your proxy
  <port>8080</port> -->Please change it accordingly
  <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>

3) 在cmd中重试。会有用的。
4) 对于eclipse,删除现有的maven项目并转到

window ->prefernces -> maven -> user settings -> browse -> configure this path apache-maven-3.5.4\conf\settings.xml

5) 删除.m2文件夹。
6) 重新启动eclipse并尝试创建新的maven项目。
这些步骤对我有用。

3pvhb19x

3pvhb19x8#

我也有同样的问题。我用了下一种方法:
1.添加了settings.xml文件(~/.m2/settings.xml)和下一个内容

<proxies>
   <proxy>
      <active>true</active>
      <protocol>http</protocol>
      <host>qq-proxya</host>
      <port>8080</port>
      <username>user</username>
      <password>passw</password>
      <nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
    </proxy>
  </proxies>

3.使用cmd转到文件夹与我的项目,并写了mvn清洁和之后,mvn安装!
在eclipse中更新项目之后(alt+f5),或者右键单击project->maven->updateproject
p、 在那之后,当我向我的项目添加新的依赖项时,我必须使用cmd(mvn compile)编译项目。因为如果我使用eclipse插件,我会在连接代理连接时出错。

qq24tv8q

qq24tv8q9#

我遇到了这个问题,我通过下一步解决了这个问题:
1-关闭eclipse。
2-转到用户目录并删除.m2目录。
3-打开elipse。
4-右键单击项目->运行方式->maven安装

dy2hfwbg

dy2hfwbg10#

I had same issue while creating new spring project in eclipse using Maven.

The main reason for this issue is that the proxy settings was not there.

I used the following approach to reslove it:
1) create settings.xml with  the below content
    <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                          https://maven.apache.org/xsd/settings-1.0.0.xsd">
      <localRepository/>
      <interactiveMode/>
      <usePluginRegistry/>
      <offline/>
      <pluginGroups/>
      <servers/>
      <mirrors/>
      <proxies>
        <proxy>
            <active>true</active>
            <protocol>http</protocol>
            <host>Your proxy</host>
            <port>Your port</port>
        </proxy>
      </proxies>
      <profiles/>
      <activeProfiles/>
    </settings>
2) Save the settings.xml file under local C:\Users\<<your user account>>\.m2
3) Then Right click project pom.XML in eclipse and select "Update Project". It always give precedence to settings.XML
2ic8powd

2ic8powd11#

跑步:

mvn -U dependency:go-offline

这对我很有用。

vdzxcuhz

vdzxcuhz12#

我也面临着上述错误。我用了eclipse。
在遵循下面的解决方案后,它对我来说很好。
解决办法是,
在eclipse中右键单击项目“pom.xml”,然后选择 Maven Install .
右击project->maven->updateproject。
刷新

kb5ga3dv

kb5ga3dv13#

我现在解决了。然而,它只能在netbeans中解决。不知道为什么eclipse仍然不接受更改后的settings.xml。但是,解决方案是删除/注解settings.xml中的user/password参数
之前:

<proxies>
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>proxyuser</username>
      <password>proxypass</password>
      <host>proxyserver.company.com</host>
      <port>8080</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
  </proxies>

之后:

<proxies>
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>proxyserver.company.com</host>
      <port>8080</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
  </proxies>
ubbxdtey

ubbxdtey14#

很好,我有办法:
只需清除(.m2)完整的文件夹和开始一个新的maven项目的问题解决了我。
注意::.m2文件夹仅位于操作系统安装的磁盘中。
如果您想知道确切的位置,请登录eclipse:
eclipse-->窗口-->首选项-->maven-->用户设置
.m2没有本地存储库路径
删除整个.m2文件夹并重新启动eclipse。

7eumitmz

7eumitmz15#

如果出现此错误,请从本地驱动器c:\users\user中删除.m2存储库,然后从那里删除.m2。原因是这是不同工作区使用的现有存储库,因此不允许创建新的应用程序

相关问题