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

安果移不動 2022-01-08 04:36:19 阅读数:559

plugin id maven plugin id

背景 昇級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

版权声明:本文为[安果移不動]所创,转载请带上原文链接,感谢。 https://gsmany.com/2022/01/202201080436185363.html