Plugin with id ‘maven‘ not found或者Plugin [id: ‘maven‘] was not found in any of the following sources

Posted 安果移不动

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Plugin with id ‘maven‘ not found或者Plugin [id: ‘maven‘] was not found in any of the following sources相关的知识,希望对你有一定的参考价值。

背景 升级build.gradle 版本到7以上

官方文档:Maven Publish Plugin

修改前

apply plugin: "maven"
//本地上传
def username = "xxx"
def pwd = "xxx"

def nexusRepositoryUrl = "https://xxx.xxx.xxx/repository/total/"
def ARTIFACT_ID = 'xxxx'
def GROUP_ID = 'com.xx'

uploadArchives 

    repositories 
        mavenDeployer 
            repository(url: nexusRepositoryUrl) 
                authentication(userName: username, password: pwd)
            
            pom.project 
                artifactId ARTIFACT_ID
                version deps.total_base.version
                groupId GROUP_ID
                packaging 'aar'
                description deps.total_base.description
            
        
    

上面的变量不变

publishing 
    publications 

        maven(MavenPublication) 
            groupId = GROUP_ID
            artifactId = ARTIFACT_ID
            version = deps.total_china.version
            description deps.total_china.description
            afterEvaluate 
                from components.release
            
        

    

    repositories 
        maven 
//            非 https 的仓库地址,需要设置 allowInsecureProtocol true
//            allowInsecureProtocol true
//            name = "nexus" //可选
            url = nexusRepositoryUrl
            credentials 
                it.username = username
                it.password = pwd
            
        

    

执行上传脚本变为

gradlew publish

以上是关于Plugin with id ‘maven‘ not found或者Plugin [id: ‘maven‘] was not found in any of the following sources的主要内容,如果未能解决你的问题,请参考以下文章

Plugin with id ‘maven‘ not foundAndroid Studio | Gradle | 插件开发

解决 Plugin with id 'com.github.dcendents.android-maven' not found.

Error:(2, 0) Plugin with id 'com.github.dcendents.android-maven' not found解决办法

运行Maven是报错:No goals have been specified for this build

docker部署报错no main manifest attribute

运行Maven工程总是报错:No goals have been specified for this build