Eclipse maven plugin getting HTTP 416 when retrieving jar - eclipse

I'm getting this error in the eclipse logs when I use the maven integration plugin for eclipse in my project:
Build errors for transport-data; org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources (default-resources) on project transport-data: Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources failed: Plugin org.apache.maven.plugins:maven-resources-plugin:2.4.3 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4, org.apache.maven.shared:maven-filtering:jar:1.0-beta-4, org.codehaus.plexus:plexus-interpolation:jar:1.13: Failure to transfer org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4 from http://repo1.maven.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. Original error: Could not transfer artifact org.codehaus.plexus:plexus-interactivity-api:jar:1.0-alpha-4 from/to central (http://repo1.maven.org/maven2): Failed to transfer http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar. Error code 416, Requested Range Not Satisfiable
From the browser I can access the jar but how come the plugin gets a 416 status response?
I'm using STS 2.7.2.RELEASE (Eclipse 3.6) with the Maven Integration plugin on Maven 2.2.1
and my OS is Ubuntu 10.10. If someone could please help explain this mystery to me I'd be very grateful.
Thanks!

I know that this is a very old request, but I just came across it too. What worked for me was deleting the relevant downloaded components in the .m2 repository. I figured that there may be some partially-loaded bits in there as I had used both Eclipse and command line with maven.
Hope this helps...

HTTP 416 means that the client requested only a portion of the file, but the server probably doesn't support such requests. Though I would be surprised if maven would have broken their repo webserver.
Another possibility is that you are behind a proxy which doesn't support range requests.

Related

How to fix this Maven error in eclipse - "Could not calculate build plan: Plugin or one of its dependencies cannot be resolved""

When trying to create a Maven project in Eclipse for Selenium, I am getting the following errors in my POM.xml :
CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.8.0 or one of its dependencies could not be resolved
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (execution: default-compile, phase: compile)
org.apache.maven.plugins:maven-resources-plugin:pom:3.0.2 from http://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. Original error: Could not transfer artifact
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.8.0:testCompile (execution: default-testCompile, phase: test-compile)
I am using the following artifacts :
Eclipse - Version: Kepler Service Release 2
Maven artifact id - maven-archetype-quickstart - v1.4
Group id - org.apache.maven.archetypes
You have to fix your settings or maven installation to use the HTTPS version of http://repo.maven.apache.org/maven2 (https://repo.maven.apache.org/maven2): that probably what is blocking your Eclipse installation from finding the dependency, and therefore from continuing.
This is what happens when you type in the HTTP url:
501 HTTPS Required.
Use https://repo.maven.apache.org/maven2/
More information at https://links.sonatype.com/central/501-https-required
To fix that:
Update your Eclipse installation to latest (2020.06)
Update your Maven to latest (3.6.3)
You may clean up the "*.lastUpdated" files from your local repository (%USERPROFILE%\.m2\repository\). They may block Maven from retrying to download dependency (their purpose is actually to avoid download missing dependency more than once a day).
If the previous items failed, you may also try to add the HTTPs repository in your settings: https://maven.apache.org/guides/mini/guide-multiple-repositories.html
Note: Kepler is very old. If you can't, for various reason, switch to latest Eclipse, you may also update maven and build the pom with maven directly rather than Eclipse. m2e (the Eclipse Plugin in charge of handling maven) does not use the mvn installation for dependency resolution.

Maven build errors after upgrading from Eclipse Luna to Mars

I've been using Eclipse Luna with the M2E plugin for some time. I recently decided to upgrade to Eclipse Mars but before I did that, I upgraded all my Maven plugins to the latest version. Once I did that, I verified that everything built on the comamnd line and also built inside Eclipse. I then fired up Eclipse Mars, installed the latest M2E plugin, and started importing my project. Unfortunately, things didn't go so well. I'm getting the following errors:
CoreException: Could not get the value for parameter compilerId for plugin execution default-compile:
PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.5 or one of its dependencies could not be resolved:
The following artifacts could not be resolved:
org.apache.maven:maven-plugin-api:jar:3.0,
org.apache.maven:maven-model:jar:3.0
org.sonatype.sisu:sisu-inject-plexus:jar:1.4.2
org.apache.maven:maven-artifact:jar:3.0
org.apache.maven:maven-core:jar:3.0
org.apache.maven:maven-settings:jar:3.0
org.apache.maven:maven-settings-builder:jar:3.0
org.apache.maven:maven-repository-metadata:jar:3.0
org.apache.maven:maven-model-builder:jar:3.0
org.apache.maven:maven-aether-provider:jar:3.0
org.sonatype.aether:aether-impl:jar:1.7
org.sonatype.aether:aether-spi:jar:1.7
org.sonatype.aether:aether-api:jar:1.7
org.codehaus.plexus:plexus-classworlds:jar:2.2.3
org.apache.maven:maven-toolchain:jar:2.2.1:
Failure to transfer org.apache.maven:maven-plugin-api:jar:3.0 from 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.
Original error: Could not transfer artifact org.apache.maven:maven-plugin-api:jar:3.0 from/to central (https://repo.maven.apache.org/maven2):
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to
find valid certification path to requested target pom.xml /pacbridge-utl line 4 Maven Project Build Lifecycle Mapping Problem
Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources failed:
Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved:
The following artifacts could not be resolved:
org.apache.maven:maven-plugin-api:jar:2.0.6
org.apache.maven:maven-project:jar:2.0.6
org.apache.maven:maven-profile:jar:2.0.6
org.apache.maven:maven-artifact-manager:jar:2.0.6
org.apache.maven:maven-plugin-registry:jar:2.0.6
org.apache.maven:maven-core:jar:2.0.6
org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.6
org.apache.maven:maven-repository-metadata:jar:2.0.6
org.apache.maven:maven-error-diagnostics:jar:2.0.6
org.apache.maven:maven-plugin-descriptor:jar:2.0.6
org.apache.maven:maven-artifact:jar:2.0.6
org.apache.maven:maven-settings:jar:2.0.6
org.apache.maven:maven-model:jar:2.0.6
org.apache.maven:maven-monitor:jar:2.0.6:
Failure to transfer org.apache.maven:maven-plugin-api:jar:2.0.6 from 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. Original error: Could not transfer
artifact org.apache.maven:maven-plugin-api:jar:2.0.6 from/to central (https://repo.maven.apache.org/maven2):
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target (org.apache.maven.plugins:maven-resources-plugin:2.6:resources:default-resources:process-resources)
I compared my Eclipse settings (between Luna and Mars) and everything looks the same. In particular, I've made sure the Windows/Preferences/General/Network Connections are the same (i.e. my proxies are setup properly) and I've tried running "mvn -U clean install" from the command line. As I say, the command line build runs fine but Eclipse Mars just won't build. Can anyone suggest a solution? BTW: I'm using Maven 3.3.3 with Java 8
Thanks.
It turns out the M2E plugin was using the wrong Settings.xml file, one that did not have a reference to the correct plugin-repo. Once I fixed the that (in Windows->Preferences->Maven->User Settings) thing started working again.

Maven offline build fails when it encouners google guava url with invalid character

I need to make my Tycho-Maven build work in offline mode, so I can deploy it to environments with no Internet connection and let people run the build from the previously downloaded artifacts for the third party code my app depends on. The product being built is an Eclipse RCP product, using the org.eclipse.tycho:target-platform-configuration plug-in to load the dependencies from an RCP target file.
First I run mvn -Dmaven.repo.local=/some/path/ -DgeneratePom=true clean install to create the artifacts, and that build succeeds. Then when I run mvn -Dmaven.repo.local=/some/path/ -o clean install it fails because it's running in offline mode and there is no local cache available for http://download.eclipse.org/tools/cdt/releases/8.6
So then I run mvn -Dmaven.repo.local=/some/path/ dependency:go-offline to make it download all the artifacts it needs for the build, but it fails with this message:
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-dependency-plugin:2.8:resolve-plugins
(resolve-plugins) on project : Nested: Could not transfer
artifact com.google.guava:guava:jar:[10.0.1,14.0.1] from/to central
(https://repo.maven.apache.org/maven2): Illegal character in path at
index 60:
https://repo.maven.apache.org/maven2/com/google/guava/guava/[10.0.1,14.0.1]/guava-[10.0.1,14.0.1].jar
Index 60 is the "[" character in the version range specifier for the guava jar. I have no idea where that URL gets created and why it's not URL-encoded. It would be nice to get the dependency:go-offline goal to complete execution, but I don't think it's the source of my problem.
The reason I say that is when I run that goal, I see this in the output
[INFO] Adding repository
http://download.eclipse.org/tools/cdt/releases/8.6 [INFO] Fetching
p2.index from http://download.eclipse.org/tools/cdt/releases/8.6/r/
(0B at 0B/s)
I don't know why it downloads 0 Bytes, but I assume this is why I can't find a cache of the CDT bundles when I try to do an offline build.
If anyone has an idea how to work around this failure, or any other approach to make an offline build work, that would be very helpful.
I created this Maven bug report in the issue tracker.
In the course of creating a stripped down project to demonstrate the problem, I discovered the cause. The presence of org.eclipse.xtend:xtend-maven-plugin in the pom was causing the problem. The plug-in is not used, and was perhaps misconfigured, per a message I saw in the build output.

ArtifactDescriptorException: Failed to read artifact descriptor Maven error

I am using the latest Eclipse for Java EE with JBoss Tools installed so Maven is included. I imported an existing Maven project to my workspace and tried to update the dependencies but I only get errors error in my POM that some argument is invalid and no artifact could have been transfered.
There are actually two different errors and maybe they depend on each other?
You can check: the server is available and I also tried to reinstall Eclipse and JBoss. So what else is missing?
ArtifactDescriptorException: Failed to read artifact descriptor for
edu.kit.aifb.ai2.sqsclient:sqsclient:jar:1.0.0:
ArtifactResolutionException: Failure to transfer
edu.kit.aifb.ai2.sqsclient:sqsclient:pom:1.0.0 from
http://eorg-ai2.aifb.kit.edu:8081/nexus/content/repositories/releases
was cached in the local repository, resolution will not be reattempted
until the update interval of Beehive has elapsed or updates are
forced. Original error: Could not transfer artifact
edu.kit.aifb.ai2.sqsclient:sqsclient:pom:1.0.0 from/to Beehive
(http://eorg-ai2.aifb.kit.edu:8081/nexus/content/repositories/releases):
Invalid argument: getsockname to
http://eorg-ai2.aifb.kit.edu:8081/nexus/content/repositories/releases/edu/kit/aifb/ai2/sqsclient/sqsclient/1.0.0/sqsclient-1.0.0.pom
There is indeed nothing in my repository-folder but .pom.lastUpdated-files
Error resolving version for plugin
'org.apache.maven.plugins:maven-shade-plugin' from the repositories
[local (C:\Users\Gregor.Gregs.m2\repository), central
(http://repo1.maven.org/maven2)]: Plugin not found in any plugin
repository
Thank you
For me it was because Eclipse was caching the exception ( even after I solved the original problem ) so try to:
right click on project -> maven -> update-project -> force to update snapshot/release -> OK.
it worked for me for a similar problem.
Check in you eclipse that settings file path is pointing to right one.
Window --> Preferences --> Maven--> User Settings.
right click on project -> maven -> update-project -> force to update snapshot/release -> OK.
it worked for me too

m2eclipse can't resolve archetypes from nexus

in our company we're using a local nexus repository. If I now try to create a new Maven project using the eclipse project wizard (M2Eclipse 0.12.1 installed) I allways get an 503 error from nexus.
org.eclipse.core.runtime.CoreException: Could not resolve artifact
at org.maven.ide.eclipse.internal.embedder.MavenImpl.resolve(MavenImpl.java:577)
at org.maven.ide.eclipse.internal.project.ProjectConfigurationManager.resolveArchetype(ProjectConfigurationManager.java:526)
at org.maven.ide.eclipse.internal.project.ProjectConfigurationManager.createArchetypeProject(ProjectConfigurationManager.java:437)
at org.maven.ide.eclipse.wizards.MavenProjectWizard$5.runInWorkspace(MavenProjectWizard.java:279)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Contains: Could not transfer artifact org.apache.maven.archetypes:maven-archetype-quickstart:pom:1.0-alpha-4 from/to nexus (http://vm-nexus-slx.heuboe.hbintern:8080/nexus/content/groups/public): Failed to transfer http://vm-nexus-slx.heuboe.hbintern:8080/nexus/content/groups/public/org/apache/maven/archetypes/maven-archetype-quickstart/1.0-alpha-4/maven-archetype-quickstart-1.0-alpha-4.pom. Error code 503, Service Unavailable
org.sonatype.aether.transfer.ArtifactTransferException: Could not transfer artifact org.apache.maven.archetypes:maven-archetype-quickstart:pom:1.0-alpha-4 from/to nexus (http://vm-nexus-slx.heuboe.hbintern:8080/nexus/content/groups/public): Failed to transfer http://vm-nexus-slx.heuboe.hbintern:8080/nexus/content/groups/public/org/apache/maven/archetypes/maven-archetype-quickstart/1.0-alpha-4/maven-archetype-quickstart-1.0-alpha-4.pom. Error code 503, Service Unavailable
at org.sonatype.aether.connector.async.AsyncRepositoryConnector$3.wrap(AsyncRepositoryConnector.java:1413)
at org.sonatype.aether.connector.async.AsyncRepositoryConnector$3.wrap(AsyncRepositoryConnector.java:1404)
at org.sonatype.aether.connector.async.AsyncRepositoryConnector$GetTask.flush(AsyncRepositoryConnector.java:895)
at org.sonatype.aether.connector.async.AsyncRepositoryConnector$GetTask.flush(AsyncRepositoryConnector.java:889)
at org.sonatype.aether.connector.async.AsyncRepositoryConnector.get(AsyncRepositoryConnector.java:276)
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:438)
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:214)
at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:296)
at org.maven.ide.eclipse.internal.embedder.MavenImpl.resolve(MavenImpl.java:555)
at org.maven.ide.eclipse.internal.project.ProjectConfigurationManager.resolveArchetype(ProjectConfigurationManager.java:526)
at org.maven.ide.eclipse.internal.project.ProjectConfigurationManager.createArchetypeProject(ProjectConfigurationManager.java:437)
at org.maven.ide.eclipse.wizards.MavenProjectWizard$5.runInWorkspace(MavenProjectWizard.java:279)
at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: org.sonatype.aether.connector.async.TransferException: Failed to transfer http://vm-nexus-slx.heuboe.hbintern:8080/nexus/content/groups/public/org/apache/maven/archetypes/maven-archetype-quickstart/1.0-alpha-4/maven-archetype-quickstart-1.0-alpha-4.pom. Error code 503, Service Unavailable
Resolving 'normal' artifacts works fine either using the integrated build or running install as "run-as" task.
I'm short before going nuts on this problem.
All ideas welcome.
Thx in advance
JayBee
Well I figured out so far that it seems, that m2eclipse is using the proxy specified in .m2/settings.xml but if relolving an archetype it ignores the nonProxyHosts.
I submitted a Bug-Report to the m2eclipse projekt:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=348893
Thx for the help.
We (my team, that is) also get this issue. Command line Maven works like a charm, in Eclipse we get a red wall by Maven (we proxy all dependencies through our Nexus).
I have however noticed, that once I set m2eclipse in Offline mode, it finds all dependencies. Since I often build in command line, resolving new dependencies this way is not an issue for me (it still might annoying for some).
Eclipse -> Window -> Preferences -> Maven
Uncheck the option - Do not automatically update dependencies from remote repositories.
This should take care of the problem.