1. 错误信息:

在cmd内查看Maven能不能正常使用。
输入命令:mvn help:system
build_failure

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  23.239 s
[INFO] Finished at: 2019-04-11T19:12:21+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-help-plugin:3.1.1:system (default-cli) on project standalone-pom: Execution default-cli of goal org.apache.maven.plugins:maven-help-plugin:3.1.1:system failed: Plugin org.apache.maven.plugins:maven-help-plugin:3.1.1 or one of its dependencies could not be resolved: Could not transfer artifact org.codehaus.plexus:plexus-component-annotations:jar:1.7.1 from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.196.215] failed: Connection timed out: connect -> [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]
[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

   
   
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
2. 解决方案

最后经过排查,发现用的默认国外服务器的问题,改为aliyun的后,问题解决。
方法如下:
修改Maven的settings.xml文件,在mirrors标签内添加:

	<mirror>
  	    <id>nexus-aliyun</id>
  		<mirrorOf>*</mirrorOf>
  		<name>Nexus aliyun</name>
  		<url>http://maven.aliyun.com/nexus/content/groups/public</url>
  	</mirror>

   
   
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

最后终于看到了SUCCESS。
这样构建JavaWeb项目也没了问题。
build_success

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐