Error while downloading 'http://maven.apache.org/xsd/maven-4.0.0.xsd' to C:\Users\Myacc\.lsp4xml\cache\http\maven.apache.org\xsd\maven-4.0.0.xsd.XML
Asked Answered
C

7

24

I am new to maven, I have installed apache-maven-3.6.1 using it via visual studio code First creating workspace was throwing error due to maven was behind proxy I updated setting.xml in maven, added proxy and workscpace was created by vsc

Its a fresh workspace, but the pom.xml is throwing error in first project tag as mentioned in title

I searched and added the same settings.xml file in C:\Users\Myacc.m2 folder and checked

I deleted the m2 folder and checked

I executed mvn clean package in project directory

none of it worked

http://maven.apache.org/xsd/maven-4.0.0.xsd">

this the xml tag which is throwing error

From browser I am able to access http://maven.apache.org/xsd/maven-4.0.0.xsd

I could not find .lsp4xml\cache\http\maven.apache.org , thought of keeping the xsd manually

Conway answered 30/8, 2019 at 11:48 Comment(4)
".lsp4xml\cache\http" looks weird it should be ".m2\repository\" instead in your home directoryImpower
I agree, but its just like that, I dont know where its taking this pathConway
I tried the similar setup in my personal home laptop, having admin right, this folder "C:\Users\Myacc\.lsp4xml\cache\http\maven.apache.org\xsd" was created already having xsd in it ---and the code is working fine as well in this pcConway
tried to copy this folder along with xsd in office pc, but no luck, still showing same errorConway
R
14

For the same problem, I found this solution. changed http to https in below line in pom file. worked in eclipse. Not sure why.

<project xmlns="https://maven.apache.org...
Regality answered 16/12, 2020 at 19:5 Comment(1)
Yes, this seemed to be a bug in the STS when creating a new Maven Project. I tried a few other hacks, but this was the simple and best :) Basically the xmlns attribute has two values within a double quote, and both of them were not in sync - as one was referring to http and other was https. Keeping them in sync did the trick. Thank you :)Lighthearted
U
5

Changing https to http made it work Note the difference in xsi:schemLocation

Incorrect:

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="https://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

Correct:

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
Usurpation answered 25/5, 2021 at 15:54 Comment(0)
P
3

For what it's worth I see same error (firewall related?) which I think is due to the XML parser LSP4XML - rather than a Maven issue. The useSystemProxies suggestion here worked for me: https://github.com/redhat-developer/vscode-xml/issues/134

Puffball answered 2/9, 2019 at 20:44 Comment(1)
In Eclipse 2020-06, I was able to fix this by adding the line -Djava.net.useSystemProxies=true to eclipse.ini.Foothill
D
2

If anyone is still following for the solution.

Issue: Admin Rights

Solution: Run the eclipse in admin mode in Windows and issue will be resolved.

Ducan answered 20/10, 2020 at 19:5 Comment(0)
W
1

If you have tried many ways to fix the error but failed, and you are using corporate network, a possible reason could be your company has blocked the download of Maven.

Weathers answered 21/9, 2023 at 8:3 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Hurtful
J
0

Running eclipse as admin solves this issue pretty well

Juliannajulianne answered 23/10, 2020 at 12:33 Comment(0)
J
0

It is related to Admin rights. You can follow one of solutions to fix problem:

  1. Open Eclipse as a administrator
  2. You can replace https to http on pom.xml *https:*//maven.apache.org/xsd/maven-4.0.0.xsd => **http:**//maven.apache.org/xsd/maven-4.0.0.xsd
Jeniferjeniffer answered 24/1, 2021 at 12:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.