【问题标题】:Maven Build failure in command prompt but getting build in eclipseMaven 在命令提示符下构建失败,但在 eclipse 中构建
【发布时间】:2019-04-19 12:26:29
【问题描述】:

我在命令提示符下使用mvn clean 命令并且构建失败。

Downloading: 
https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean- 
plugin/2.5/maven-clean-plugin-2.5.pom
[INFO] Reactor Summary:
[INFO] ABC ......................................... FAILURE [  2.226 s]
[INFO] BUILD FAILURE
[INFO] Total time: 3.098 s
[INFO] Finished at: 2018-11-16T15:10:36+05:30
[INFO] Final Memory: 12M/153M
 [ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of 
its 
 dependencies could not be resolved: Failed to read artifact descriptor for 
 org.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer 
artifact 
org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central 
(https://repo.maven.apache.org/maven2): Received fatal alert: 
protocol_version - 
> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e 
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR] For more information about the errors and possible solutions, 
please 
read the following articles:
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

但是当我在 Eclipse 内部使用 mvn clean 命令时,它正在成功构建。

[INFO] --------------------------------------------------------------------- 
---
Downloading: 
http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean- 
plugin/2.4.1/maven-clean-plugin-2.4.1.pom
Downloaded: 
http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean- 
plugin/2.4.1/maven-clean-plugin-2.4.1.pom (5 KB at 5.2 KB/sec)
-------------------------
[INFO] BUILD SUCCESS
[INFO] Total time: 4.387s

我能看到的区别是,在命令提示符下它正在尝试下载 maven-clean-plugin-2.5,而从 eclipse 中它正在成功下载 2.4.1

但我只需要运行 2.5 即可。 谁可以帮我这个事。 谢谢。

【问题讨论】:

  • 请将您的pom.xml相关部分发帖
  • 你有代理吗?
  • maven-resources-plugin2.5 @RobAu
  • 对代理不太了解。但我在公司网络@SasikumarMurugesan

标签: java eclipse maven pom.xml


【解决方案1】:

我不知道你是否全局安装了 maven。你可以尝试全局安装maven。按照步骤操作。

  1. maven download link下载maven

  2. 创建或导出 M2_HOME="MAVEN ROOT LOCATION"。前任。 : E:\SoftwareRepo\building tools\apache-maven-3.5.2

  3. 创建或导出 MAVEN bin 文件夹位置到 PATH 变量。例如:E:\SoftwareRepo\building tools\apache-maven-3.5.2\bin

  4. 打开终端或cmd运行mvn --version确认maven是否安装。

您可以像使用 Eclipse 一样使用它。 然后去日食。并设置项目。按照以下步骤操作

  1. 导入现有的 maven 项目或创建一个 maven 项目
  2. 转到项目资源管理器并右键单击您的 pom.xml
  3. 然后选择 Run As maven install。
  4. 然后是你想要的。 希望它能达到你的目的。您可以下载sample spring boot project

或者您可以从终端或 cmd 运行 maven 项目。只需转到项目根文件夹,然后运行 ​​maven clean install 之类的 maven 任务。快乐编码:)

【讨论】:

  • 所有步骤都已完成。看来我在公司网络上,Maven 无法连接到互联网
猜你喜欢
  • 2014-06-19
  • 1970-01-01
  • 1970-01-01
  • 2022-12-16
  • 1970-01-01
  • 2014-04-03
  • 2021-09-23
  • 2014-10-18
  • 1970-01-01
相关资源
最近更新 更多