我有一个需要进行的Maven项目。我安装了Eclipse SE(Mars 2,因为我需要在JDK 1.7上工作),并且只是试图将项目导入为an existing Maven project
,但是在Eclipse中却遇到此错误:
我从here下载了maven 3.5.4,并将bin
添加到了我的路径。现在,我尝试从项目文件夹中的命令行mvn clean
开始,出现此错误:
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.792 s
[INFO] Finished at: 2018-06-26T09:42:32-05:00
[INFO] ------------------------------------------------------------------------
[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]
[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
看起来这是一个普遍的错误,但我还无法解决。怎么解决呢?我的settings.xml
文件夹中没有看到.m2
。
答案 0 :(得分:0)
如果在.m2文件夹中看不到setting.xml,则可以手动创建文件,并且需要将文件显式放置在该位置。放置文件后,用于Eclipse的maven插件也将开始使用该文件。
您要做的另一件事是尝试将项目移至其他位置。 例如:c:\ users \ <> \ Workspace \ Project \到E:\ Workspace \ Project \看起来很奇怪,但有时此解决方案可行。
答案 1 :(得分:0)
删除.m2文件夹确实很有帮助。然后我遇到了其他问题。我必须在windows--> preferences --> installed JREs
中将JDK编译器(而不是JRE)设置为默认编译器。然后其他问题最终得以解决。