Maven dependencies are failing with a 501 error

前端 未结 25 3220
南旧
南旧 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:33

    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.

    0 讨论(0)
提交回复
热议问题