我正在尝试将 Artifact 部署到私有(private) bitbucket 存储库。我正在关注本教程 https://medium.com/@Mul0w/publish-with-gradle-on-bitbucket-1463236dc460以及其他一些堆栈帖子并设法达到了一个不错的点。但是我被困住了。
我已将以下 uploadArchives 任务添加到 gradle。
uploadArchives {
configuration = configurations.archives
repositories.mavenDeployer {
pom.groupId = GROUPID
pom.artifactId = ARTIFACTID
pom.version = VERSION
configuration = configurations.deployerJar
repository(url: "git:master://git@bitbucket.org:<Team Name>/<Repo Name>.git"){
authentication(userName: <username>, password: <password>)
}
pom.project {
name POM_NAME
packaging POM_PACKAGING
description POM_DESCRIPTION
url POM_URL
scm {
url POM_SCM_URL
connection POM_SCM_CONNECTION
developerConnection POM_SCM_DEV_CONNECTION
}
licenses {
license {
name POM_LICENCE_NAME
url POM_LICENCE_URL
distribution POM_LICENCE_DIST
}
}
developers {
developer {
id DEVELOPER_ID
name DEVELOPER_NAME
email DEVELOPER_EMAIL
}
}
}
}
}
当我运行命令 ./gradlew assembleRelease :module:uploadArchives --info
我收到以下错误
Failed to deploy artifacts: Could not transfer artifact "<group id>":"<artifact id>":aar:"<version number>" from/to remote (git:master://git@bitbucket.org:<team name>/<repo name>.git): Unable to put file
为什么 gradle 无法将 Artifact 传输到我的存储库的主分支?任何帮助将不胜感激。
最佳答案
您链接的页面说明该分支应为 releases
,而不是 master
.由于这种方式对我有用,我建议坚持下去。所以它应该看起来像:
repository(url: "git:releases://git@bitbucket.org:<Team Name>/<Repo Name>.git")
此外,您正在尝试将这个 Gradle 脚本身份验证数据放入其中。
我不知道它是否会起作用,因为我正在使用 SSH key 作为 bitbucket 帐户进行 git 身份验证。
关于maven - 在私有(private) BitBucket 存储库上部署 AAR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47536971/