我在内部托管的GitLab实例上配置了Maven存储库,我想开始在那里部署Android库。
我正在尝试遵循此guide。但是,当我尝试将其部署到内部GitLab Maven存储库(组级别)时,出现此错误:
任务':legocore:publishAarPublicationToMavenRepository'的执行失败。
无法将发布“ aar”发布到存储库“ maven” 无法写入资源'https://internal-gitlab.org/mobile-apps/-/packages/maven/org/weather/4.0.4/weather-4.0.4.aar'。 无法放置'https://internal-gitlab.org/mobile-apps/-/packages/maven/org/weather/4.0.4/weather-4.0.4.aar'。从服务器收到状态码404:找不到
我正在build.gradle中使用“ maven-publish”插件,这是我的部署部分:
publishing {
publications {
aar(MavenPublication) {
groupId = 'some.id'
version = libraryVersion
artifactId project.getName()
artifact("$buildDir/outputs/aar/${project.getName()}-release.aar")
artifact androidSourcesJar
pom.withXml {
asNode().children().last() + {
resolveStrategy = DELEGATE_FIRST
url 'https://somedomain.org'
name project.getName()
description 'It is pretty nice weather'
organization {
name 'Hellow World'
url 'https://somedomain.org'
}
scm {
url 'https://internal-gitlab.org/mobile-apps/sdk/android/weather.git'
connection 'https://internal-gitlab.org/mobile-apps/sdk/android/weather.git'
developerConnection 'https://internal-gitlab.org/mobile-apps/sdk/android/weather.git'
}
}
def dependencies = asNode().appendNode('dependencies')
configurations.getByName("releaseCompileClasspath").getResolvedConfiguration().getFirstLevelModuleDependencies().each {
def dependency = dependencies.appendNode('dependency')
dependency.appendNode('groupId', it.moduleGroup)
dependency.appendNode('artifactId', it.moduleName)
dependency.appendNode('version', it.moduleVersion)
}
}
repositories {
maven {
url "https://internal-gitlab.org/mobile-apps/-/packages/maven"
}
}
}
}
}
task androidSourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
}
artifacts{
archives androidSourcesJar
}
有什么想法吗?可能缺少“ distributionManagement”部分?但是如何在我的build.gradle中添加它们呢?还是其他?
谢谢
索伦