Execution failed for task ':demo01:publishMavenPublicationToMaven3Repository'.
> Failed to publish publication 'maven' to repository 'maven3'
   > Using insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository 'maven3(http://localhost:8082/repository/repos0/)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols. See https://docs.gradle.org/7.0.2/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details. 

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

使用gradle上传本地aar到本地maven私用服务器时报了上面的错误信息;

因为用了http而不是https导致的,http明文传输不安全,因为是自己用nexus搭建的demo maven环境,所以没有去折腾https,直接用了其自带的jett web容器;解决办法是

allowInsecureProtocol = true

具体代码如下:

         // 仓库
         maven {
             allowInsecureProtocol = true

             // 凭证
             credentials {
                 username 'abcdefg' // 仓库发布用户名
                 password 'passw' // 仓库发布用户密码
             }
             // 地址
             url 'http://localhost:8082/repository/repos0/'
         }

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐