Gonzalo
Gonzalo

Reputation: 319

Error protocol_version Java 6 with maven 3.2.5

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.

Upvotes: 0

Views: 2629

Answers (2)

David Hladky
David Hladky

Reputation: 525

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.

Upvotes: 0

Stephen C
Stephen C

Reputation: 718826

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.

Upvotes: 4

Related Questions