简体   繁体   中英

Unable to run my Maven project on Windows

I got a Maven project that I need to work on. I installed Eclipse SE (Mars 2 as I need to work on JDK 1.7), and was simply trying to import the project as an existing Maven project , but get this error in Eclipse:

在此处输入图片说明

I downloaded maven 3.5.4 from here and added the bin to my path. Now I try to mvn clean from command line in the project folder, I get this error:

[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

Looks like it's a popular error, but I couldn't fix it yet. How to resolve it? I don't see a settings.xml in my .m2 folder.

If you don't see setting.xml in .m2 folder then you can manually create the file and you need to place the file explicitly at that location. After placing the file maven plugin for eclipse will start using that file too.

One more thing you an do is try moving your project to different location. eg:c:\\users\\<>\\Workspace\\Project\\ to E:\\Workspace\\Project\\ that looks weird but sometime this solution works.

Deleting the .m2 folder really helped. Then I ran into other problems. I had to set JDK compiler (as opposed to JRE) as my default compiler in windows--> preferences --> installed JREs . Then other issues where eventually followed and resolved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM