When trying to run a NetBeans project, I get the following error message:
Failed to execute goal
org.apache.maven.plugins:maven-surefire-plugin:2.10:test
(default-test) on project MyNetBeansProject: Execution default-test of goal
org.apache.maven.plugins:maven-surefire-plugin:2.10:test failed:
Plugin org.apache.maven.plugins:maven-surefire-plugin:2.10 or one of
its dependencies could not be resolved: Failed to collect dependencies
for org.apache.maven.plugins:maven-surefire-plugin:jar:2.10 (): Failed
to read artifact descriptor for
org.apache.maven.surefire:surefire-booter:jar:2.10: Could not transfer
artifact org.apache.maven.surefire:surefire-booter:pom:2.10 from/to
central (http://repo.maven.apache.org/maven2): Failed to transfer
file:
http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-booter/2.10/surefire-booter-2.10.pom.
Return code is: 501 , ReasonPhrase:HTTPS Required. -> [Help 1]
The following part of the error message is the most important one:
Failed to transfer file:
http://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-booter/2.10/surefire-booter-2.10.pom.
Return code is: 501 , ReasonPhrase:HTTPS Required.
Services -> Maven Repositories -> Central Repository -> right mouse click on "Central Repository" gives the following information:
As one can see, the Remote Repository URL is "http://repo.maven.apache.org/maven2/". I think it should instead be "https://repo.maven.apache.org/maven2/".
However, the problem is that I can't seem to change the Remote Repository URL.
Does anybody know how to change maven's Remote Repository URL in the NetBeans IDE?
UPDATE:
Under NetBeans -> Preferences one can see that the maven version used by my NetBeans IDE is Version 3.0.5:
Best Answer
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.
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:
Instructions how to install standalone version here.
If you set the Maven Home in NetBeans correctly it will show you updated version:
3. Quick and not recommended
Just add repositories into your pom.xml with https (for example like that)
Maven Central Migrated to https
The problem comes from this:
Here is the relevant improvement that was resolved and relevant changes.