217

Recently Maven build jobs running in Jenkins are failing with the below exception saying that they couldn't pull dependencies from Maven Central and should use HTTPS. I'm not sure how to change the requests from HTTP to HTTPS. Could someone guide me on this matter?

[ERROR] Unresolveable build extension:
Plugin org.apache.maven.wagon:wagon-ssh:2.1 or one of its dependencies could not be resolved:
Failed to collect dependencies for org.apache.maven.wagon:wagon-ssh:jar:2.1 ():
Failed to read artifact descriptor for org.apache.maven.wagon:wagon-ssh:jar:2.1:
Could not transfer artifact org.apache.maven.wagon:wagon-ssh:pom:2.1 from/to central (http://repo.maven.apache.org/maven2):
Failed to transfer file: http://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-ssh/2.1/wagon-ssh-2.1.pom.
Return code is: 501, ReasonPhrase:HTTPS Required. -> [Help 2]

Waiting for Jenkins to finish collecting data[ERROR]
Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one of its dependencies could not be resolved:
Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1:
Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.4.1 from/to central (http://repo.maven.apache.org/maven2):
Failed to transfer file: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom.
Return code is: 501 , ReasonPhrase:HTTPS Required. -> [Help 1]

Community
  • 1
  • 1
Arunan Sugunakumar
  • 3,311
  • 3
  • 12
  • 20
  • 5
    You are using the http://repo.maven.apache.org/maven2 url to connect to the maven central, instead use https://repo.maven.apache.org/maven2/ i.e use https connection – Manjunath H M Jan 16 '20 at 05:35
  • 2
    check your `settings.xml` in jenkins for the maven central url – varontron Jan 16 '20 at 05:41
  • Hi Manjunath, I have the same problem. Do you know how to force maven to use HTTPS instead of HTTP – Lahiru Madushanka Jan 16 '20 at 05:41
  • @Lahiru Madushanka go through the links, so you get a answer for your question https://stackoverflow.com/questions/25393298/what-is-the-correct-way-of-forcing-maven-to-use-https-for-maven-central/25411658 – Manjunath H M Jan 16 '20 at 05:50
  • Which version of maven are you using? Seems like latest maven versions (3.6.0, 3.6.1) are using the https URL by default – farasath Jan 16 '20 at 07:17
  • 1
    I have changed the maven version to 3.6.3 and still it showing the same error – dhS Mar 16 '20 at 15:23

28 Answers28

177

The reason for the observed error is explained in Central 501 HTTPS Required

Effective January 15, 2020, The Central Repository no longer supports insecure communication over plain HTTP and requires that all requests to the repository are encrypted over HTTPS.

It looks like latest versions of Maven (tried with 3.6.0, 3.6.1) are already using the HTTPS URL by default.

Here are the dates when the major repositories will switch:

Your Java builds might break starting January 13th (if you haven't yet switched repo access to HTTPS)

Update: Seems like from maven 3.2.3 maven central is accessed via HTTPS See https://stackoverflow.com/a/25411658/5820670

Maven Change log (http://maven.apache.org/docs/3.2.3/release-notes.html)

farasath
  • 2,961
  • 2
  • 15
  • 16
  • 36
    Hi! I'm the original researcher that kicked off this industry wide initiative. You can find my blog post about the important dates here as well: https://medium.com/@jonathan.leitschuh/update-want-to-take-over-the-java-ecosystem-all-you-need-is-a-mitm-d069d253fe23?source=friends_link&sk=8c8e52a7d57b98d0b7e541665688b454 – Jonathan Leitschuh Jan 16 '20 at 16:39
  • 1
    @JonathanLeitschuh please write a full answer which can be voted on and accepted... – Thorbjørn Ravn Andersen Jan 16 '20 at 23:02
  • 1
    I am using maven 3.6.0 on Ubuntu 18.04 but it does not seem to be using https url. – Ashutosh Jan 16 '20 at 23:25
  • @Ashutosh: same thing there with Maven 3.6.1 on Ubuntu 19.10. I'm not sure why this is the case, it could be an Ubuntu patch, but why would they do that?). To solve this, use any of the answers below that update the `settings.xml` file (and upvote them, please, as this is the correct solution, other than using a patched Maven). – Guss Jan 23 '20 at 10:41
  • So, I explicitly have configured `settings.xml` to use HTTPS repositories.. which it can, with `wget`, but for some very strange reason, `mvn archetype:generate -X` (to just test whether dependencies can be downloaded) it still prints it is accessing to `Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom` Any help, please.. ? – Giorgi Tsiklauri Feb 06 '20 at 09:53
  • I just installed Maven 3.3.9 yesterday to work with Java Eclipse and running into the same errors as original poster. Can I simply install the new Maven 3.6.3 to upgrade it? Or do I want to uninstall 3.3.9 first? – BigRedEO Feb 11 '20 at 16:30
  • For people who use package manager and have maven installed from default repository, it is better to download and manually install maven. The latest version from repository might not have such HTTPS behavior by default. – kayochin Mar 25 '20 at 05:33
  • @GiorgiTsiklauri - append -DarchetypeCatalog=[https://repo.maven.apache.org/maven2/archetype-catalog.xml](https://repo.maven.apache.org/maven2/archetype-catalog.xml) as per this answer: https://stackoverflow.com/a/70209429/4795356 – tanderson Dec 03 '21 at 04:11
128

I am facing the same problem. There are two solutions that I tried, and both works fine for me.

  • Update the Maven version repository (Maven version >= 3.2.3)
  • Restrict the current Maven version to use HTTPS links.

Update the Maven version repository:

Download the Apache Maven binary that includes the default https addresses (Apache Maven 3.6.3 binary). And open the Options dialog window in tools of NetBeans menu bar (Java Maven Dialog View). And select browse option in Maven Home List Box (Maven Home List Box View). After adding the Apache Maven newly downloaded version (Updated Maven Home List Box View), the project builds and runs successfully.

Restrict the current Maven version to use HTTPS links:

Include the following code in pom.xml of your project.

<project>
      ...
    <pluginRepositories>
        <pluginRepository>
            <id>central</id>
            <name>Central Repository</name>
            <url>https://repo.maven.apache.org/maven2</url>
            <layout>default</layout>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <releases>
                <updatePolicy>never</updatePolicy>
            </releases>
        </pluginRepository>
    </pluginRepositories>
    <repositories>
        <repository>
            <id>central</id>
            <name>Central Repository</name>
            <url>https://repo.maven.apache.org/maven2</url>
            <layout>default</layout>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
</project>
scohe001
  • 15,110
  • 2
  • 31
  • 51
Muhammad umer
  • 1,401
  • 1
  • 8
  • 8
42

Effective January 15, 2020, The Central Repository no longer supports insecure communication over plain HTTP and requires that all requests to the repository are encrypted over HTTPS.

If you're receiving this error, then you need to replace all URL references to Maven Central with their canonical HTTPS counterparts.

(source)

We have made the following changes in my project's build.gradle:

Old:

repositories {
   maven { url "http://repo.maven.apache.org/maven2" }
}

New:

repositories {
   maven { url "https://repo.maven.apache.org/maven2" }
}
Matthew Green
  • 10,161
  • 4
  • 36
  • 54
Ashwani
  • 1,340
  • 1
  • 16
  • 34
  • Yes i have replace in setting.xml file but unfortunately it still not working. Am i doing right or there is any other file need to change? – Sumeet Vishwas Jan 16 '20 at 06:29
  • @SumeetVishwas Can you share a sample settings.xml file? – Arunan Sugunakumar Jan 16 '20 at 06:52
  • 3
    @ArunanSugunakumar i didn't change in settings.xml. All you need to change in POM. update central repository of maven. I put the sample of central repository in answer thread. please find below – Sumeet Vishwas Jan 16 '20 at 10:04
  • 1
    The OP's question says, "I am not sure how to change the requests from HTTP to HTTPS." This answer does not address the question. – wchargin Jan 16 '20 at 16:14
34

Try to hit the below URL in any browser. It will return 501

http://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-ssh/2.1/wagon-ssh-2.1.pom

Please try with https. It will download a pom.xml file:

https://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-ssh/2.1/wagon-ssh-2.1.pom

Please add it (https://repo.maven.apache.org/maven2) in the setting.xml file:

<repositories>
   <repository>
      <id>Central Maven repository</id>
      <name>Central Maven repository https</name>
      <url>https://repo.maven.apache.org/maven2</url>
   </repository>
</repositories>
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sarjit
  • 799
  • 7
  • 9
  • 1
    Can you please provide an example of a full setting.xml as I have unsuccessfully tried to add the above into the file? – jhertz Feb 18 '20 at 15:16
  • 2
    Found this answer that made the location in the file clearer, now it works: https://stackoverflow.com/a/59784045/3120576 – jhertz Feb 18 '20 at 15:33
26

I was using a clean install of Maven/Java on a Docker container.

For me, I had to cd $M2_HOME/conf and edit the settings.xml file there. Add the following block inside <mirrors>...</mirrors>

<mirror>
  <id>central-secure</id>
  <url>https://repo.maven.apache.org/maven2</url>
  <mirrorOf>central</mirrorOf>
</mirror>
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
mehulmpt
  • 15,861
  • 12
  • 48
  • 88
24

Update the central repository of Maven and use https instead of http.

<repositories>
    <repository>
        <id>central</id>
        <name>Central Repository</name>
        <url>https://repo.maven.apache.org/maven2</url>
        <layout>default</layout>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
</repositories>
Shehan Dhaleesha
  • 627
  • 1
  • 10
  • 30
Sumeet Vishwas
  • 585
  • 1
  • 6
  • 18
  • I tried this in Pom and it worked well: central repo https Central Repository Https https://repo.maven.apache.org/maven2 . – lam Jan 16 '20 at 12:59
  • 1
    Thanks. This is working in ubuntu 18.10, using Netbeans. Had to set Maven home to the latest Maven version in Netbeans. Where did you find this solution? – Sanal S Jan 27 '20 at 04:10
  • You might have to update the plugin repository as well. At least it had to be done for me as well, in order to be fixed. – Kim Tang Feb 19 '20 at 12:30
  • Doesn't work for Windows, Netbean version 8.2 – Huy Phạm Nov 11 '21 at 17:02
19

Add this in pom.xml file. It works fine for me

<pluginRepositories>
    <pluginRepository>
        <id>central</id>
        <name>Central Repository</name>
        <url>https://repo.maven.apache.org/maven2</url>
        <layout>default</layout>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <releases>
            <updatePolicy>never</updatePolicy>
        </releases>
    </pluginRepository>
</pluginRepositories>

<repositories>
    <repository>
        <id>central</id>
        <name>Central Repository</name>
        <url>https://repo.maven.apache.org/maven2</url>
        <layout>default</layout>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
</repositories>
LAWSON
  • 191
  • 1
  • 2
14

Maven is moving to HTTPS and disabling HTTP access

Short story, from January 15, 2020, Maven Central repository is not longer supporting HTTP connections (other repositories are doing the same). Therefore, you will indicate your Maven/Gradle settings to use an HTTPS URL.

Solution:

You can choose one of the following three approaches.

  1. Add a repository in your project´s pom.xml file

    <project>
    ...
      <repositories>
        <repository>
          <id>central maven repo</id>
          <name>central maven repo https</name>
          <url>https://repo.maven.apache.org/maven2</url>
        </repository>
      </repositories>
    </project>
    
  2. Add the repository into a profile in the settings.xml file.

    <profile>
      <id>my profile</id>
      <repositories>
        <repository>
          <id>central maven repo</id>
          <name>central maven repo https</name>
          <url>https://repo.maven.apache.org/maven2</url>
          </repository>
      </repositories>
    </profile>
    
  3. Update you maven version to a new one that uses https values as default. The lastest one at this moment 3.6.3 Download here

For Gradle:

Only replace the URL for the HTTPS version.

repositories {
   maven { url "https://repo.maven.apache.org/maven2" }
}
  • To upgrade (3.3.9 to 3.6.3) do you need to completely uninstall the older version first? Or just install the latest version? – BigRedEO Feb 11 '20 at 17:03
  • 1
    @BigRedEO You can have more than one maven version in your environment. However, your `$M2_HOME` or your `$PATH ` env variables will point only to one of them, which will be your default maven version. I would prefer to uninstall the older one before installing a newer one. But, that depends on your needs. – Adam M. Gamboa G. Feb 11 '20 at 22:33
14

I was added following code segment to setting.xml and it was resolved the issue,

<mirrors>
    <mirror>
        <id>maven-mirror</id>
        <name>Maven Mirror</name>
        <url>https://repo.maven.apache.org/maven2</url>
        <mirrorOf>central</mirrorOf>
    </mirror>
</mirrors>
Samith
  • 160
  • 7
13

I was using an outdated version of Maven (3.0.3 and 3.1). These older versions no longer supports http repositories (as mentioned above). Upgrading to Maven 3.6 was the fix for me.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
JC Lombard
  • 131
  • 2
  • 1
    From maven 3.2.3, Central is accessing via HTTPS by default http://maven.apache.org/docs/3.2.3/release-notes.html – farasath Jan 20 '20 at 08:04
9

I have the same issue, but I use GitLab instead of Jenkins. The steps I had to do to get over the issue:

  1. My project is in GitLab so it uses the .yml file which points to a Docker image I have to do continuous integration, and the image it uses has the http://maven URLs. So I changed that to https://maven.
  2. That same Dockerfile image had an older version of Maven 3.0.1 that gave me issues just overnight. I updated the Dockerfile to get the latest version 3.6.3
  3. I then deployed that image to my online repository, and updated my Maven project ymlfile to use that new image.
  4. And lastly, I updated my main projects POM file to reference https://maven... instead of http://maven

I realize that is more specific to my setup. But without doing all of the steps above I would still continue to get this error message Return code is: 501 , ReasonPhrase:HTTPS Required

CAMD_3441
  • 2,514
  • 2
  • 23
  • 38
9

As stated in other answers, https is now required to make requests to Maven Central, while older versions of Maven use http.

If you don't want to/cannot upgrade to Maven 3.2.3+, you can do a workaround by adding the following code into your MAVEN_HOME\conf\settings.xml into the <profiles> section:

<profile>
    <id>maven-https</id>
    <activation>
        <activeByDefault>true</activeByDefault>
    </activation>
    <repositories>
        <repository>
            <id>central</id>
            <url>https://repo1.maven.org/maven2</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>central</id>
            <url>https://repo1.maven.org/maven2</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories> 
</profile>

This will be always an active setting unless you disable/override it in your POM when needed.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ellrohir
  • 1,017
  • 1
  • 14
  • 32
8

For me (corporate coder) also adding a mirror repository in the settings.xml fixed the issue. I am also using Maven inside a docker container.

<mirrors>
    <mirror>
        <id>https-mirror</id>
        <name>Https Mirror Repository</name>
        <url>https://repo1.maven.org/maven2</url>
        <mirrorOf>central</mirrorOf>
    </mirror>
</mirrors>
Oscar Drai
  • 141
  • 1
  • 7
  • Could you show me where can we find the settings.xml file, @Oscar? – Han Van Pham Jan 22 '20 at 04:09
  • Sure! In our Dockerfile, we first put it in a temp folder like this: echo "...." > /tmp/maven-settings.xml. Then, we run maven with the "-s" option and pass the path to the settings file like this "mvn -s /tmp/maven-settings.xml clean". Hope it helps! – Oscar Drai Jan 23 '20 at 10:28
  • @han-van-pham you find it in $HOME/.m2/ . If not, create it there. – dr0i Mar 16 '20 at 08:39
7

For all the corporate coders, ideally, if you get this error, it means that your code base is still being built from open-source community. You need to over ride the "central" repository with your in house company Maven repository manager.

You can go to your settings.xml and override your central repository URL from http:// to https://

<M2_HOME>/conf/settings.xml

Find the mirrors sections and add the following entry:

    <mirror>
     <id>other-mirror</id>
     <name>Other Mirror Repository</name>
     <url>https://other-mirror.repo.other-company.com/maven2</url>
     <mirrorOf>central</mirrorOf>
    </mirror>

In the URL section, if you were using either http://repo1.maven.org/maven2/ or http://repo.maven.apache.org/maven2/ then

Replace http://repo1.maven.org/maven2/ with https://repo1.maven.org/maven2/

Replace http://repo.maven.apache.org/maven2/ with https://repo.maven.apache.org/maven2/

You need to ideally use your company source control management/repository URL over here. As this will block any contact with open source Maven repository community.

As mentioned in other answers, effective from 15 January 2020, the central Maven repository doesn't support insecure communication over plain HTTP.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Bhavik Shah
  • 358
  • 4
  • 11
  • After adding the mirror in mirrors section I've got an error, that peer not authenticated. What should I do now? Thanks! – dimson Jan 23 '20 at 09:35
  • @dimson This means that you tried to connect with https but you were missing certificate for authentication, probably because of Java not having it. Import certificate from repository into java keystore, or upgrade java. – tibortru Jan 23 '20 at 11:09
  • @tibortru Thanx Man, already solve the problem. I've added these properties to maven in IDE: maven.wagon.http.ssl.insecure=true maven.wagon.http.ssl.allowall=true maven.wagon.http.ssl.ignore.validity.dates=true https.protocols=TLSv1,TLSv1.1,TLSv1.2. After that all works fine. – dimson Jan 23 '20 at 11:35
  • Ye, well that's the other way. Non-secure one :) – tibortru Jan 23 '20 at 12:54
7

If you are using Netbeans older version, you have to make changes in maven to use https over http

Open C:\Program Files\NetBeans8.0.2\java\maven\conf\settings.xml and paste below code in between mirrors tag

<mirror>
<id>maven-mirror</id>
<name>Maven Mirror</name>
<url>https://repo.maven.apache.org/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>

It will force maven to use https://repo.maven.apache.org/maven2 url.

raw
  • 409
  • 1
  • 5
  • 11
  • IMO this solution doesn't depend on the IDE. It worked for me on adding this entry to $MVN_HOME/conf/settings.xml file. Thanks! – Debojit Saikia May 03 '22 at 15:16
5

Using Ubuntu 16.04, java 1.8.0_201.

I un-installed old maven and installed Maven 3.6.3, still got this error that Maven dependencies are failing with a 501 error.

Realized it could be a truststore/keystore issue associated with requiring https. Found that you can now configure -Djavax options using a jvm.config file, see: https://maven.apache.org/configure.html.

As I am also using Tomcat I copied the keystore & truststore config from Tomcat (setenv.sh) to my jvm.config and then it worked!

There is also an option to pass the this config in 'export MAVEN_OPTS' (when using mvn generate) but although this stopped the 501 error it created another: it expected a pom file.

Creating a separate jvm.config file works perfectly, just put it in the root of your project.

Hopefully this helps someone, took me all day to figure it out!

user2677034
  • 624
  • 10
  • 20
4

Same issue is also occuring for jcenter.

From 13 Jan 2020 onwards, Jcenter is only available at HTTPS.

Projects getting their dependencies using the same will start facing issues. For quick fixes do the following in your build.gradle

instead of

repositories {
jcenter ()
//others
}

use this:

repositories {
jcenter { url "http://jcenter.bintray.com/"}
//others
}
saurabh gupta
  • 491
  • 6
  • 18
4

The error:

Failed to transfer file: http://repo.maven.apache.org/maven2/org/apache/maven/wagon/wagon-ssh/2.1/wagon-ssh-2.1.pom.

Return code is: 501 , ReasonPhrase:HTTPS Required.

Root cause analysis:

Maven central is expecting that the clients use https, but the client is making plain HTTP request only.

Therefore, the request for downloading the package named 'wagon-ssh-2.1.pom' had failed.

How to fix the problem?

Replace the URL "http://repo.maven.apache.org/maven2"

with "https://repo.maven.apache.org/maven2"

in pom.xml file or build.gradle file of the project.

Gopinath
  • 4,066
  • 1
  • 14
  • 16
4

My current environment does not support HTTPS, so adding the insecure version of the repo solved my problem: http://insecure.repo1.maven.org as per Sonatype

    <repositories>
       <repository>
          <id>Central Maven repository</id>
          <name>Central Maven repository insecure</name>
          <url>http://insecure.repo1.maven.org</url>
       </repository>
    </repositories>
Rega
  • 880
  • 8
  • 16
4

The following link got me out of the trouble,

https://support.sonatype.com/hc/en-us/articles/360041287334-Central-501-HTTPS-Required

You could make the changes either in your maven, apache-maven/conf/settings.xml. Or, if you are specifying in your pom.xml, make the change there.

Before,

<repository>
            <id>maven_central_repo</id>
            <url>http://repo.maven.apache.org/maven2</url>
</repository>

Now,

<repository>
            <id>maven_central_repo</id>
            <url>https://repo.maven.apache.org/maven2</url>
</repository>

Note the change from http to https

Siena
  • 778
  • 10
  • 23
3

Sharing this in case anyone needs it:

Old Gradle config( without Gitlab , Docker deployments , for simple projects)

repositories {
google()
jcenter()

maven { url "http://dl.bintray.com/davideas/maven" }
maven { url 'https://plugins.gradle.org/m2/' }
maven { url 'http://repo1.maven.org/maven2' }
maven { url 'http://jcenter.bintray.com' }
}

New config :

repositories {
google()
jcenter()

maven { url "https://dl.bintray.com/davideas/maven" }
maven { url 'https://plugins.gradle.org/m2/' }
maven { url 'https://repo1.maven.org/maven2' }
maven { url 'https://jcenter.bintray.com' }
}

Notice the https. Happy coding :)

BMU
  • 429
  • 2
  • 9
3

Originally from https://stackoverflow.com/a/59796324/32453 though this might be useful:

Beware that your parent pom can (re) define repositories as well, and if it has overridden central and specified http for whatever reason, you'll need to fix that (so places to fix: ~/.m2/settings.xml AND also parent poms).

If you can't fix it in parent pom, you can override parent pom's repo's, like this, in your child pom (extracted from the 3.6.3 default super pom, seems they changed the name from repo1 as well):

  <repositories>
    <repository>
      <id>central</id>
      <name>Central Repository</name>
      <url>https://repo.maven.apache.org/maven2</url> <!-- the https you've been looking for -->
      <layout>default</layout>
      <snapshots>
        <enabled>false</enabled> <!-- or set to true if desired, default is false -->
      </snapshots>
    </repository>
  </repositories>
rogerdpack
  • 62,887
  • 36
  • 269
  • 388
1

This error occured to me too. I did what Muhammad umer said above. But, it only solved error for spring-boot-dependencies and spring-boot-dependencies has child dependencies. Now, there were 21 errors. Previously, it was 2 errors. Like this:

Non-resolvable import POM: Could not transfer artifact org.springframework.cloud:spring-cloud-dependencies:pom:Hoxton.SR3 from/to central

and also https required in the error message.

I updated the maven version from 3.2.2 to 3.6.3 and java version from 8 to 11. Now, all errors of https required are gone.

To update maven version

  1. Download latest maven from here: download maven
  2. Unzip and move it to /opt/maven/
  3. Set the path export PATH=$PATH:/opt/maven/bin
  4. And, also remove old maven from PATH
Ashish Sharma
  • 617
  • 6
  • 15
1

On an old grails environment the only thing that works without upgrading is:

settings.xml

   <settings>
    <mirrors>
        <mirror>
          <id>centralhttps</id>
          <mirrorOf>central</mirrorOf>
          <name>Maven central https</name>
          <url>http://insecure.repo1.maven.org/maven2/</url>
        </mirror>
      </mirrors>
  </settings>
aarroyo
  • 11
  • 2
0

I downloaded latest eclipse and tarted to use from here https://www.eclipse.org/downloads/packages/release/ which resolved my problem.

sunleo
  • 10,589
  • 35
  • 116
  • 196
0

I hit this problem with the latest version (August 2020) (after not using Maven on this machine for ages) and was scratching my head as to why it could still be an issue after reading these answers.

Turns out I had an old settings.xml sitting in the .m2/ folder in my home directory with some customisations from years ago.

However, even deleting that file didn't fix it for me. I ended up deleting the entire .m2 folder.
I don't think there was anything else in it except for downloaded resources. Maybe just deleting folders like repository/org/apache/maven/archetype would have been sufficient.

Patrick Herrera
  • 3,120
  • 26
  • 21
0

I downloaded the last netbeans version 12.2, and the problem was resolved.

-2

Add the following repository in pom.xml.

<project>
...
    <repositories>
        <repository>
            <id>central</id>
            <name>Maven Plugin Repository</name>
            <url>https://repo1.maven.org/maven2</url>
            <layout>default</layout>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
...
</project>

AlanSTACK
  • 5,525
  • 3
  • 40
  • 99
Sathesh
  • 63
  • 3