1

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:

enter image description here

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.

Tina J
  • 4,983
  • 13
  • 59
  • 125
  • What Java 1.7 version do you have? Try with the very latest and if that doesn't help see https://stackoverflow.com/questions/39157422/how-to-enable-tls-1-2-in-java-7. – ewramner Jun 26 '18 at 14:57
  • `java version "1.7.0_80"` ... I've been told the project is only compatible with Java 7. – Tina J Jun 26 '18 at 14:58
  • I read that this had been fixed in 1.7.0_131, but apparently 80 is the latest release publicly available. Set -Dhttps.protocols=TLSv1.2 (see link above). – ewramner Jun 26 '18 at 15:01
  • 1
    I updated the MAVEN_OPTS to `-Dhttps.protocols=TLSv1.2 -Xms256m -Xmx512m`...still have same problem. – Tina J Jun 26 '18 at 15:11
  • Would you run command with **-X switch** and then paste trace here ? That would be helpful to understand your problem. – Jayesh Choudhary Jun 26 '18 at 15:35
  • https://central.sonatype.org/articles/2018/May/04/discontinue-support-for-tlsv11-and-below/ – khmarbaise Jun 26 '18 at 15:38
  • 1
    Try deleting everything in the .m2 folder and running maven again. – Madz Jun 26 '18 at 16:14
  • deleting helped a bit! At least now I can `mvn clean` successfully! But I get this error now: – Tina J Jun 26 '18 at 16:22
  • `Plugin org.apache.maven.plugins:maven-compiler-plugin:3.5.4 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugins:maven-compiler-plugin:jar:3.5.4 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced` – Tina J Jun 26 '18 at 16:22
  • @JayeshChoudhary Here is the -X output: https://justpaste.it/67wet – Tina J Jun 26 '18 at 16:23

2 Answers2

0

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.

Dhirendra Gautam
  • 737
  • 8
  • 16
0

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.

Tina J
  • 4,983
  • 13
  • 59
  • 125