Could not HEAD ‘XXX.jar‘. Received status code 401 from server: Unauthorized

今天在部署服务的时候,一个包引用不到编译出问题了,报错如下:

   > Could not download JwtPermission.jar (com.github.whvcse:JwtPermission:1.0.9)
      > Could not get resource 'https://jitpack.io/com/github/whvcse/JwtPermission/1.0.9/JwtPermission-1.0.9.jar'.
         > Could not HEAD 'https://jitpack.io/com/github/whvcse/JwtPermission/1.0.9/JwtPermission-1.0.9.jar'. Received status code 401 from server: Unauthorized

点开这个链接需要登录,

解决方案:

在使用的具体服务上:单独引用,再加上对应的版本号,就可以解决了;

第1://compile "com.github.whvcse:JwtPermission" 把引用配置中心加载的注释掉阿

第2:// maven { url 'https://jitpack.io' }  把这行也注释掉
用公司的仓库或者阿里云的仓库
repositories {
    maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
    // maven { url 'https://jitpack.io' }
    mavenCentral()

    maven {
        name 'nexus'
        url "http://xxx:ip/repository/maven-releases/"
        credentials {
            username project.username
            password project.userpassword
        }
    }
    maven {
        name 'nexus'
        url "http://xxx:ip/repository/maven-snapshots/"
        credentials {
            username project.username
            password project.userpassword
        }
    }
第3: 直接引用目标包,包括目标版本号
compile "com.github.whvcse:JwtPermission:1.0.9" 
compile "io.jsonwebtoken:jjwt:0.6.0"

我的是gradle的,在build.gradle文件中添加这个,单独引用。

Guess you like

Origin blog.csdn.net/u010953880/article/details/120873580