发布自己的私有Android库到自己的gitlab

问题描述 投票:0回答:1

我正在使用本教程来为自己的目的制作内部库。我创建了模块,添加了发布

.gradle
文件:

apply plugin: 'maven-publish'

publishing {
    publications {
        myPublish (MavenPublication) {
            groupId "id"
            artifactId "utilsmobile"
            version "1.0.0"
            artifact "$buildDir/outputs/aar/utilsmobile-release.aar"


            pom.withXml {
                def dependencies = asNode().appendNode('dependencies')
                configurations.named("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://gitlab.com/api/v4/projects//packages/maven"
            credentials(HttpHeaderCredentials) {
                name = "utils_pkg"
                value = "token"
            }
            authentication {
                header(HttpHeaderAuthentication)
            }
        }
    }
}

并添加到模块

build.gradle
这一行:

apply from: "$rootDir/Utils/gradle-mvn-push.gradle"

但是我在Android Studio的gradle仪表板中没有看到任何新的Gradle任务,并且不明白如何将其发布到自己的存储库。也许我需要将其声明为一个单独的任务或者我做错了什么?

android gradle
1个回答
0
投票

您似乎缺少一种

MavenPublication
配置:

from components.java
© www.soinside.com 2019 - 2024. All rights reserved.