How to change maven's Remote Repository URL in the NetBeans IDE (from http to https)?

Within the Netbeans installation, this worked for me:

Goto Netbeans installation folder > java > maven > conf, and here I updated the settings.xml file using administrative privilege.

as http repo link will not work now, just I created an mirror for central repo that is pre-built with IDE which cannot be changed.

Add this inside mirrors tag of settings.xml

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

after this restart netbeans IDE, and central repository will be overridden with the mirror we specify.


I think you have three options.

1. Migrate to 11.0

You can migrate to Netbeans 11.0 LTS (or 11.2), it uses a built-in Maven 3.3.9 version. It already uses https.

enter image description here

2. Install standalone Apache Maven

You can stay with Netbeans 8.2 but download standalone apache maven, install it to your system and set the path to the new maven home directory in Options -> Java -> Maven -> Maven Home.

You need just:

  1. Download apache-maven-3.6.3-bin.zip (or apache-maven-3.6.3-bin.tar.gz) from Apache
  2. Unzip it to any directory. It will be the Maven home.
  3. Set the Maven home directory in NetBeans to the directory where you have extracted zip file.
  4. Ensure than you have set JAVA_HOME in your environment variables

Instructions how to install standalone version here.

If you set the Maven Home in NetBeans correctly it will show you updated version: enter image description here

3. Quick and not recommended

Just add repositories into your pom.xml with https (for example like that)

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

Maven Central Migrated to https

The problem comes from this:

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

Here is the relevant improvement that was resolved and relevant changes.