eclipse 无法计算构建计划 :artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3 在本地存储库中不可用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7378279/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 20:30:33  来源:igfitidea点击:

Could not calculate build plan :artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3 is not available in the local repository

eclipsejakarta-eemaven-2mavenmaven-plugin

提问by Mahmoud Saleh

I have a spring maven 2 project. I built it in terminal and everything is ok, I got build success, but when trying to import it to eclipse I got this error:

我有一个 spring maven 2 项目。我在终端中构建它,一切正常,构建成功,但是在尝试将其导入 eclipse 时出现此错误:

Could not calculate build plan: The repository system is offline but the artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3 is not available in the local repository.

无法计算构建计划:存储库系统处于离线状态,但工件 org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3 在本地存储库中不可用。

although I am getting build success in terminal and projects run fine. I made maven offline in eclipse, and disabled download index on startup any ideas why I am getting this error?

尽管我在终端中获得了成功并且项目运行良好。我在 Eclipse 中使 Maven 离线,并在启动时禁用了下载索引,为什么我会收到此错误?

采纳答案by bmargulies

If your pom is not specific as to the version of the maven-resources-plugin, that version will come from the superpom. By default, m2e uses an embedded copy of Maven 3.0.x. If the superpom there points to 2.4.3 and your 'outside-of-Eclipse' version asks for something else, then the Maven inside of Eclipse will go looking for 2.4.3 and fail due to the 'offline'.

如果您的 pom 不是特定于 maven-resources-plugin 的版本,则该版本将来自 superpom。默认情况下,m2e 使用 Maven 3.0.x 的嵌入式副本。如果那里的 superpom 指向 2.4.3 并且您的“外部 Eclipse”版本要求其他内容,那么 Eclipse 内部的 Maven 将寻找 2.4.3 并由于“离线”而失败。

Fix by configuring m2e to use the Maven installation you are using outside, or turning off 'offline' for one build.

通过将 m2e 配置为使用您在外部使用的 Maven 安装或关闭一个构建的“离线”来修复。

回答by Prasanna Talakanti

If you want to use maven from your local installation instead of the embedded version that comes with m2e, You have to do this

如果您想从本地安装使用 maven 而不是 m2e 附带的嵌入式版本,您必须这样做

  • Windows ==> Preferences ==> Maven ==> Installations ==> Click Add (select your local maven installation directory)
  • Windows ==> Preferences ==> Maven ==> Installations ==> 点击Add(选择你本地的maven安装目录)

回答by Smit

Just right click on the project in eclipse and in the maven option select update maven project and dont forget to check force update check box and finally hit on ok. It worked for me.

只需右键单击eclipse中的项目并在maven选项中选择更新maven项目,不要忘记选中强制更新复选框,最后点击确定。它对我有用。

回答by Karan Thakur

add below line to your pom.xml and build it through command line using ‘mvn install'. That will download the plugin and then try to build from Eclipse. make sure your Eclipse is using the same Maven not the embeded one. If you are still having issues, delete it from local repository and try again. The line to add is

将以下行添加到您的 pom.xml 并使用“mvn install”通过命令行构建它。这将下载插件,然后尝试从 Eclipse 构建。确保您的 Eclipse 使用相同的 Maven 而不是嵌入式的。如果仍有问题,请将其从本地存储库中删除,然后重试。要添加的行是

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
</plugin>
</plugins>
</build>

before doing that find where your local repo is, then go to "/.m2/repository/org/apache/maven/plugins/maven-resources-plugin/", remove the contents and do "update dependencies" from Maven.

在此之前找到您的本地存储库所在的位置,然后转到“/.m2/repository/org/apache/maven/plugins/maven-resources-plugin/”,删除内容并从 Maven 执行“更新依赖项”。

回答by harshul

Try Right clicking on POM.xml --> maven --> update project.

尝试右键单击 POM.xml --> maven --> 更新项目。