0

Hi I'm having an error with maven in java 1.6.

I already tried a lot of solutions in stackoverflow and other websites but I don't know how to solve it.

So here's the Error log:

    [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 uk (https://repo1.maven.org/maven2/): Received fatal alert: protocol_version -> [Help 1]
org.apache.maven.plugin.PluginResolutionException: 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
    at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:122)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:150)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:269)
    at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:239)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecution(DefaultLifecycleExecutionPlanCalculator.java:158)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecutions(DefaultLifecycleExecutionPlanCalculator.java:145)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:122)
    at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:135)
    at org.apache.maven.lifecycle.internal.builder.BuilderCommon.resolveBuildPlan(BuilderCommon.java:97)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:109)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:302)
    at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:217)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:287)
    at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:108)
    ... 25 more

I'm using Java 1.6 JDK and Maven 3.2.5 (found that this is the last version that allows java 1.6).

I already tried using set MAVEN_OPTS=-Dhttps.protocols=TLSv1.1,TLSv1.2 on maven settings.xml

If I do an "Update Project" with maven, it works perfectly and also if I try to connect to the URL that maven try to reach I can open it, but in Eclipse it fails.

If you need more information let me know and I will be updating the post.

Thanks in advise.

Gonzalo
  • 309
  • 2
  • 6
  • 18
  • 1
    Can you try to force a check for updated releases and snapshots by running `mvn -U clean install`? What's the output? Also why are you using [EOL Java version](https://www.oracle.com/technetwork/java/java-se-support-roadmap.html#JavaSESupport)? – Boris Feb 18 '20 at 12:56
  • Same error @Boris – Gonzalo Feb 18 '20 at 12:58
  • I believe Java 6 only supported TLSv1 (maybe TLSv1.1), so likely it can't communicate with servers requiring higher TLS versions. Do you really need to use Java 6 to run your Maven, you could also use a newer version, and use the source/target settings to compile to a lower Java version. – Mark Rotteveel Feb 18 '20 at 13:00
  • Java 6 does not support TLSv1.2 which is needed. You have to use at least JDK 7 with `-Dhttps.protocolls=TLSv1.2`.... – khmarbaise Feb 18 '20 at 13:01
  • What do you mean by in eclipse it fails ? Did it work from your command line ? – rootkonda Feb 18 '20 at 13:04

2 Answers2

4

The root causes of your problems:

(The Maven version is not implicated in this. The "protocol_version" error is coming from the Java 6 built-in JCE provider which doesn't understand TLSv1.2 or later.)

Your possible solutions are:

  • Upgrade to Java 7 (or better still Java 8 or 11). Java 6 is EOL. You shouldn't be using it, and your customers shouldn't be using it.

  • Try to use a 3rd-party JCE provider in the Java 6 JVM that is running Maven; see How to use TLS 1.2 in Java 6 for suggestions.

  • Set up your own Artifactory or Nexus repository as a cache for Maven Central, and configure Maven to use it.

  • Configure Maven to use HTTP (not HTTPS) when talking to Maven Central; see Force m2e to use http instead of https. (But note this makes your build processes vulnerable to sneaky injection of trojan horse versions of your dependencies.)

  • Download and add the artifacts that you need (dependency POM and JAR files) to your local (e.g. ~/.m2) Maven repository by hand.


Note that upgrading is the best solution. Life is only going to get more difficult for people who don't upgrade their Java platform. You (or your predecessors) should have upgraded in 2012 ... before Java 6 public updates ceased.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • I really appreciatte your answer, will try all of them except the upgrade. I know is the best solution but it's not in my hand (hope it could be). The weird thing is that I already download the 2.5 version and put inside .m2 folder but still the same error. – Gonzalo Feb 18 '20 at 15:16
0

It is likely too late for you. But another possible fix of this problem would be using a proxy server, that would run over http (or some older encryption protocol).

Using outdated protocols is a security risk, so be sure to run it the way it would not be exposed to the internet. But in cases you really can not upgrade your environment this may be the way to go. There are free applications to proxy data (e.g. Sonatype Nexus). Your application would fetch the files from Nexus and Nexus will use up-to-date protocol to read the files from Maven Central.

David Hladky
  • 495
  • 7
  • 14