Maven dependencies are failing with a 501 error

前端 未结 25 3688
南旧
南旧 2020-11-22 06:28

Recently Maven build jobs running in Jenkins are failing with the below exception saying that they couldn\'t pull dependencies from Maven Central

25条回答
  •  庸人自扰
    2020-11-22 07:29

    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

      
      ...
        
          
            central maven repo
            central maven repo https
            https://repo.maven.apache.org/maven2
          
        
      
      
    2. Add the repository into a profile in the settings.xml file.

      
        my profile
        
          
            central maven repo
            central maven repo https
            https://repo.maven.apache.org/maven2
            
        
      
      
    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" }
    }
    

提交回复
热议问题