How to Solve Maven Error: Return code is: 501 , ReasonPhrase:HTTPS Required.

When using jenkins to build today, the following error was reported

  [ERROR] Failed to execute goal on project saas20: Could not resolve dependencies for project com.ipower365.saas:saas20:war:0.0.1-SNAPSHOT: Failed to collect dependencies at com.ipower365.saas:messageserviceimpl:jar:0.0.1-SNAPSHOT -> com.ipower365.boss:nacha:jar:1.0.1: Failed to read artifact descriptor for com.ipower365.boss:nacha:jar:1.0.1: Could not transfer artifact com.ipower365.boss:nacha:pom:1.0.1 from/to central ( to transfer file: Return code is: 501 , ReasonPhrase:HTTPS Required. -> [Help 1]

We found that this dependent file is available in the local warehouse, but during the build process, after downloading the file in the local nexus, it will still request the file download like the central warehouse.

    [echoing saas20] Downloading from central:

After that, we searched for the problem based on the returned 501 error. The reference link is as follows:



As mentioned above, since January 15, 2020, the central repository no longer supports insecure communication via pure HTTP, and requires all requests to the repository to be encrypted via HTTPS.

So we added the following configuration to the settings file that we relied on during the build process:

<name>Maven Repository Switchboard</name>

But the problem is still not resolved, and then an error is reported, the error is as follows:

    Could not transfer artifact com.ipower365.boss:nacha:pom:1.0.1 from/to central ( fatal alert: protocol_version -> [Help 1]

This is when using the https protocol to request the central warehouse, the protocol version needs to be specified, and then the following parameters are added when building, the reference link is as follows:


Then when you build again, the request is passed!

Reason: Our Java environment uses 7 and 8, while our mvn version uses 3.5.x.

Therefore, when using mvn packaging in the JAVA8 environment, the above parameters do not need to be specified, but when using the JAVA7 environment, the above error will occur. Later, we will consider updating the version of mvn and unified JAVA environment

Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *